select … from A join B … order by orderNo desc limit 1
zhenglee
2020-08-25 10:47:07 +08:00
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo FROM Persons LEFT JOIN Orders ON Persons.Id_P=Orders.Id_P where Orders.OrderNo in (select max(OrderNo) from Orders group by ID_P) ORDER BY Persons.LastName
SELECT a.LastName , a.FirstName , b.OrderNo FROM Persons a LEFT JOIN( SELECT MAX(OrderNo) OrderNo , Id_P FROM Orders GROUP BY ID_P ) b ON a.Id_P = b.Id_P;
第 1 页 / 共 1 页
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。