本文介绍了选择最高版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 从会计软件BOMLIST链接表格,提供装配项目的物料清单。 该表包含以下字段: AssemblyItem / RevisionNumber / Effective Date / ComponentItem / QtyRequired。 RevisionNumber 默认值为0,并且最初没有填充日期。 如果BOM发生了变化,它会在下一个连续的RevisionNumber中添加其他记录,并填充生效日期。Have a table linked from accounting software, BOMLIST, that provides the bills of material for assembly items. The table includes the following fields: AssemblyItem / RevisionNumber / Effective Date / ComponentItem / QtyRequired. The RevisionNumber default is 0 and there is no date populated initially. If there is a change to the BOM, it adds additional records with the next sequential RevisionNumber and populates the Effective Date.我需要以最有效/最有效的方式选择作为其中一部分的记录最高版本号只能这样它们可用于生产路由器。I need to most effective / efficient way to select the records that are part of the highest revision number only so they can be used for a production router.推荐答案以前的3d怎么样: https://social.msdn.microsoft.com/Forums/office/en-US/bf07da70-59a1-4fcb-a24d-8f8861ee69bc / form-criteria?forum = accessdevhttps://social.msdn.microsoft.com/Forums/office/en-US/bf07da70-59a1-4fcb-a24d-8f8861ee69bc/form-criteria?forum=accessdev解决了这个问题?我会建议两种方式: SELECT T. AssemblyItem ,SELECT T.AssemblyItem ,          T. ComponentItem , T.ComponentItem,          T. QtyRequired ,T。 RevisionNumber , T.QtyRequired, T.RevisionNumber,           T. [生效日期] FROM T.[Effective Date]FROM        yourTable AS t $ 内部加入 yourTable AS tinner join         (选择 ( select max( RevisionNumber )作为MaxR max(RevisionNumber) as MaxR from from yourTabele )作为T1 yourTabele ) as T1            在 on                t。 RevisionNumber = t1.MaxR t.RevisionNumber=t1.MaxR            或者t。[生效日期] 为空 ; or t.[Effective Date] is null; --- -------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------- SELECT T. AssemblyItem,SELECT T.AssemblyItem ,            T.ComponentItem, T.ComponentItem ,            T.QtyRequired, T.QtyRequired,            T.RevisionNumber, T.RevisionNumber ,           T. [生效日期] FROM T.[Effective Date]FROM         YourTable AS t $ WHERE YourTable AS tWHERE         t。 RevisionNumber =(选择 t.RevisionNumber =( select max(t1。 RevisionNumber )作为MaxDateR max(t1.RevisionNumber) as MaxDateR from from yourTable as t1 yourTable as t1 where where t1.AssemblyItem = T.AssemblyItem)                          或 t1.AssemblyItem =T.AssemblyItem) or                                t。[ 生效日期] 为空 ; ; t.[Effective Date] is null;;第一个应该比第二个运行得快,通常的连接比相关的子查询更快first one should run faster than the second, usualluy join is faster then a correlated subQuery替换"yourTable"使用您的方案表的真实姓名。Replace "yourTable" with the real name of the table of your scenario. HTH Ciao,Sandro。Ciao, Sandro. 这篇关于选择最高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-12 02:22