📜  获取最后日期加入 sql 代码示例

📅  最后修改于: 2022-03-11 15:05:06.904000             🧑  作者: Mango

代码示例1
SELECT customer.*, purchase.*
FROM customer
JOIN (
   SELECT DISTINCT ON (customer_id) *
   FROM purchase
   ORDER BY customer_id, date DESC
) purchase ON purchase.customer_id = customer.id