Hi all,<br /> I need help on creating a sql, not a problem even if its pl/sql<br /><br /> I have orders table schema
isas follow<br /><br /> orders(order_id,user_id, create_timestamp, amount)<br /><br /> and I want to generate a report
like<br/> for the past 3 days bucketing purchases i.e SUM(amount) every day in columns<br /> i.e result will be having
thesecolumns.<br /><br /> (user_id, amount_day1, amount_day2, amount_day3)<br /><br /> ex:<br /> am leaving order_id
assumethey are auto incrementing and unique, date format dd/mm/yyyy<br /> (user_id, create_timestamp, amount)<br />
(user1,01/01/2009,100)<br /> (user1, 01/01/2009,100)<br /> (user2, 01/01/2009,100)<br /> (user2, 02/01/2009,100)<br />
(user2,02/01/2009,100)<br /> (user1, 02/01/2009,100)<br /> (user2, 03/01/2009,100)<br /> (user2, 03/01/2009,100)<br />
(user3,03/01/2009,100)<br /><br /><br /> result<br /><br /> (user_id, amount_day1, amount_day2, amount_day3)<br />
(user1,200, 200, 0)<br /> (user2, 100, 200, 200)<br /> (user3, 0, 0, 100)<br /><br /><br /> hope you guys got what I am
tryingto generate through sql.<br /><br /> I could get this data in each row, but I want it in columns.<br /> Can
anyonehelp me on this? lets assume the buckets are fixed i.e 3 only. but I wish to get them unlimited i.e day 1 to day
20.<br/><br /><table cellpadding="0" cellspacing="0" width="100%"><tr><td> Regards<br /> Sandeep Bandela
</td></tr></table>