[AccessD] Top 3 query returns only one record

Wortz, Charles CWortz at tea.state.tx.us
Tue May 13 13:58:15 CDT 2003


Chester,
 
Check the thread "SQL in-line subquery" for Dave Sharpe's response of
last Wednesday.  He had a link to an article that should answer your
question about your subquery.
 

Charles Wortz 
Software Development Division 
Texas Education Agency 
1701 N. Congress Ave 
Austin, TX 78701-1494 
512-463-9493 
CWortz at tea.state.tx.us 

-----Original Message-----
From: Kaup, Chester A [mailto:kaupca at chevrontexaco.com] 
Sent: Tuesday 2003 May 13 13:46
To: ACCESSD at databaseadvisors.com
Subject: [AccessD] Top 3 query returns only one record



The following query returns only one record per well_label rather than
the last 3 like I need. I don't see the problem-been looking at it to
long. Thanks

SELECT TEST_DATE, FIELD_CODE, SAP_BORE_COMP_NUMBER, WELL_LABEL, GAS_VOL,
OIL_VOL, WATER_VOL 
FROM [TBL T15 WELL TESTS] 
WHERE TEST_DATE IN 
(SELECT TOP 3 TEST_DATE 
FROM [TBL T15 WELL TESTS] 
ORDER BY TEST_DATE DESC) 
ORDER BY WELL_LABEL ASC, TEST_DATE DESC; 

No trees were killed in the sending of this message. However a large
number of electrons were terribly inconvenienced.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030513/1ca6c50c/attachment-0001.html>


More information about the AccessD mailing list