有没有办法找到min(创建日期)并从访问查询中删除它?
答案 0 :(得分:0)
您可以使用MIN()函数选择MIN()日期的记录。
SELECT Item_Number, Order_Number, Order_Line_Number, MIN(Creation_Date)
FROM *tblName*
GROUP BY Item_Number, Order_Number, Order_Line_Number
或者您可以在“创建日期”列中使用MAX()函数来排除具有最小日期的记录。
SELECT Item_Number, Order_Number, Order_Line_Number, MAX(Creation_Date)
FROM *tblName*
GROUP BY Item_Number, Order_Number, Order_Line_Number
或者如果您最初提到的确想要使用MIN()日期从MS Access表中删除记录,请使用以下查询。
DELETE **tbl_A.*** FROM
*tblName tbl_A* INNER JOIN *tblName tbl_B*
WHERE
tbl_A.Item_Number = tbl_B.Item_Number
AND
tbl_A.Order_Number = tbl_B.Order_Number
AND
tbl_A.Order_Line_Number = tbl_B.Order_Line_Number
AND
tbl_A.Creation_Date = tbl_B.MIN(Creation_Date)