Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: MIN function help
Lizzie schrieb am 04.08.2005 in
<1123148486.640299.165820_at_g14g2000cwa.googlegroups.com>:
> Can you help me with some SQL (probably really simple)?
> I want to bet the first deposit date and amount for each user so wrote
> this query:
> SELECT b.user_id, MIN(date_inserted), b.amount/100 as amount_deposited
> FROM rpt_player_cash_summary a, gl_user_transactions b
> WHERE a.user_id = b.user_id
> AND b.status = 'COMPLETE'
> AND b.type = 'DEPOSIT'
> GROUP BY b.user_id, b.amount
> ORDER BY user_id;
something like
SELECT b.user_id, c.first_time, b.amount/100 as amount_deposited
FROM rpt_player_cash_summary a
JOIN gl_user_transactions b
ON a.user_id = b.user_id
JOIN (
select
user, MIN(date_inserted) first_time,
from
gl_user_transactions) c
ON
c.user=b.user
WHERE
AND b.status = 'COMPLETE'
AND b.type = 'DEPOSIT'
GROUP BY b.user_id, b.amount
ORDER BY user_id;
I hope I understood you correctly. This is only posted and not tested.
hth
Andreas Mosmann
-- wenn email, dann AndreasMosmann <bei> web <punkt> deReceived on Thu Aug 04 2005 - 06:23:58 CDT
![]() |
![]() |