Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: MIN function help

Re: MIN function help

From: Andreas Mosmann <keineemails_at_gmx.de>
Date: Thu, 04 Aug 2005 13:23:58 +0200
Message-ID: <1123154638.27@user.newsoffice.de>


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> de
Received on Thu Aug 04 2005 - 06:23:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US