Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!drn.maxwell.syr.edu!news.maxwell.syr.edu!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail
From: "Lizzie" <elizabeth_dutton@yahoo.co.uk>
Newsgroups: comp.databases.oracle.misc
Subject: MIN function help
Date: 4 Aug 2005 02:41:26 -0700
Organization: http://groups.google.com
Lines: 28
Message-ID: <1123148486.640299.165820@g14g2000cwa.googlegroups.com>
NNTP-Posting-Host: 212.158.252.170
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1123148492 16870 127.0.0.1 (4 Aug 2005 09:41:32 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 4 Aug 2005 09:41:32 +0000 (UTC)
User-Agent: G2/0.2
Complaints-To: groups-abuse@google.com
Injection-Info: g14g2000cwa.googlegroups.com; posting-host=212.158.252.170;
   posting-account=aANhHQ0AAACLwa96MuTek8LelPVty6T0
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.misc:121041

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;

Here's a sample of data returned.  If you look at user_id 181156, there
are multiple entries.  I just want the query to return the row for
21/07/2005.

USER_ID	MIN(DATE_INSERTED)	AMOUNT_DEPOSITED
181068	20/07/2005 21:10:12	10
181131	21/07/2005 17:22:50	20
181156	21/07/2005 22:20:20	10
181156	28/07/2005 03:15:56	20
181165	21/07/2005 23:49:58	10
181238	23/07/2005 00:41:25	50
181323	24/07/2005 14:11:20	30

Please can you help?

