Hi Jeremy,

I have a orders table, which has order_id and status_id and date

orders
======
id    order_id    status_id    date
1     123         22           2021-03-22
33    123         55           2021-03-29

How do I write a query to fetch the difference between the dates of two 
records with the same order_id.

The output required is -

order_id   date_diff
123        7

Database can be either Posgres or SQLite.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/888a5403-059a-4473-94be-d99d5bb471d0n%40googlegroups.com.

Reply via email to