(((tblFormal.Who4EID)= [Forms]![frmRptDesign]![cmbEID]))或 (((tblFormal.Who5EID)= [Forms]![frmRptDesign] ![cmbEID])); * Sherwood Wang MVP * Hi,I''m stuck on the following query. Any help would be greatly appreciated! table1: Customersuid, name1, bob2, jane3, john table2: Purchasesuid, custID, datepurchase, item1, 1, 1/1/2004, mouse2, 1, 1/2/2004, keyboard3, 1, 1/3/2004, usb key4, 2, 1/1/2004, mouse5, 2, 6/19/2004, keyboard6, 3, 1/1/2004, printer I want a query to show what customers'' last purchase is.i.e. results:bob, 1/3/2004, usbkeyboardjane, 9/19/2004, keyboardjohn, 1/1/2004, printer Does anyone know how to do this? /r 解决方案 SELECT tblGroup.GroupID, tblGroup.GroupName, tblRegion.RegID,tblRegion.RegName, tblLocation.LID, tblLocation.LocName,tblIncident.IncdntDate, IIf((Not IsNull([RemAct1]) And IsNull([Done1])),1,0)AS Open1, IIf((Not IsNull([RemAct1]) And Not IsNull([Done1])),1,0) ASClosed1, IIf((Not IsNull([RemAct2]) And IsNull([Done2])),1,0) AS Open2,IIf((Not IsNull([RemAct2]) And Not IsNull([Done2])),1,0) AS Closed2,IIf((Not IsNull([RemAct3]) And IsNull([Done3])),1,0) AS Open3, IIf((NotIsNull([RemAct3]) And Not IsNull([Done3])),1,0) AS Closed3, IIf((NotIsNull([RemAct4]) And IsNull([Done4])),1,0) AS Open4, IIf((NotIsNull([RemAct4]) And Not IsNull([Done4])),1,0) AS Closed4, IIf((NotIsNull([RemAct5]) And IsNull([Done5])),1,0) AS Open5, IIf((NotIsNull([RemAct5]) And Not IsNull([Done5])),1,0) AS Closed5FROM ((tblRegion INNER JOIN tblLocation ON tblRegion.RegName =tblLocation.RegName) INNER JOIN (tblIncident INNER JOIN tblFormal ONtblIncident.GUIncdntID = tblFormal.GUIncdntID) ON tblLocation.LID =tblIncident.LID) INNER JOIN tblGroup ON tblRegion.GroupID = tblGroup.GroupIDWHERE (((tblFormal.Who1EID)=[Forms]![frmRptDesign]![cmbEID])) OR(((tblFormal.Who2EID)=[Forms]![frmRptDesign]![cmbEID])) OR(((tblFormal.Who3EID)=[Forms]![frmRptDesign]![cmbEID])) OR(((tblFormal.Who4EID)=[Forms]![frmRptDesign]![cmbEID])) OR(((tblFormal.Who5EID)=[Forms]![frmRptDesign]![cmbEID])); *Sherwood Wang MVP* 这篇关于SQL帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-26 21:03