Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- *
- FROM TableA
- LEFT JOIN TableB
- ON TableB.customer_id = TableA.customer_id
- ORDER BY COALESCE(TableB.payDate, '1900-01-01') DESC
- select customer.customer_id, customer.first_name, customer.last_name,
- max(payment.payment_date)
- from customer
- left outer join payment on payment.customer_id = customer.customer_id
- group by customer.customer_id, customer.first_name, customer.last_name
- order by max(payment.payment_date) desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement