Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

get last date join sql

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #date #join #sql
ADD COMMENT
Topic
Name
6+6 =