Article View: borland.public.interbase.sql
Article #919Same line SELECT MIN
From: aleplgr
Date: Tue, 24 Apr 2007 09:14
Date: Tue, 24 Apr 2007 09:14
13 lines
1181 bytes
1181 bytes
Hi, I have this problem: my table is
PATIENTID, DATE, DIFF
for each PATIENTID can be many DATE and many DIFF, DIFF is an integer and I need for each PATIENTID the MIN DIFF and the DATE of the same line where MIN(DIFF) is.
I did this: but it's not working
SELECT PATIENTID,DATE,DIFF FROM T MYTABLE
WHERE DIFF = (SELECT MIN(DIFF) FROM Q MYTABLE
WHERE (T.PATIENTID = Q.PATIENTID
AND T.DATE = Q.DATE )
Technical Details
Message-ID:
<462dca7d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,67140aa9ee91b46d,start X-Google-Attributes: gid114a0e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "aleplgr" <aleplgr@yahoo.es> Sender: "aleplgr" <aleplgr@yahoo.es> Reply-To: "aleplgr" <aleplgr@yahoo.es> Subject: Same line SELECT MIN Newsgroups: borland.public.interbase.sql X-User-Info: 80.58.205.38 X-Forwarded-For: 80.25.195.180, 192.168.1.66 NNTP-Posting-Host: 207.105.83.66 Message-ID: <462dca7d$1@newsgroups.borland.com> Date: 24 Apr 2007 02:14:37 -0700 X-Trace: newsgroups.borland.com 1177406077 207.105.83.66 (24 Apr 2007 02:14:37 -0700) Lines: 14 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail