Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to aggregate values from different rows but same user
Colin, a little thinking on your part should lead you to conclude that
select * from usage where in_out = 'in' is a table of the start times select * from usage where in_out = 'out' is a table of the end times if you join these two tables on the user you have your first example I will leave the SQL syntax to you
Problem number 2
Look up the CASE statement or the DECODE function in the SQL manual or
in your text book
You can use either to assign users to a bucket
Sum the bucket
Again I will leave the actual SQL statement to you
HTH -- Mark D Powell -- Received on Wed Sep 21 2005 - 19:40:38 CDT
![]() |
![]() |