I have a script to get the days between an order date and a fill date. something like:
select
transid,
trans_date a,
trans_date b,
b.trans_date - a.trans_date
from
transactions a,
transactions b
where
a.transid = b.transid
I tried to turn this into a group select and ave the days between the two dates, so I can check the ave for a given year or month, but no matter how I group it, I cant get the numbers to work out. I need to product something like:
2001/01 15
2001/02 12
2001/03 14
etc
etc
2001/12 12
____
2001 13.5
any help would be greatly appreciated
select
transid,
trans_date a,
trans_date b,
b.trans_date - a.trans_date
from
transactions a,
transactions b
where
a.transid = b.transid
I tried to turn this into a group select and ave the days between the two dates, so I can check the ave for a given year or month, but no matter how I group it, I cant get the numbers to work out. I need to product something like:
2001/01 15
2001/02 12
2001/03 14
etc
etc
2001/12 12
____
2001 13.5
any help would be greatly appreciated