Re: [SQL] locked my keys in the car

From: Thomas Good <tomg(at)q8(dot)nrnet(dot)org>
To: Richard Lynch <lynch(at)lscorp(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] locked my keys in the car
Date: 1998-08-04 19:15:19
Message-ID: Pine.SV4.3.91.980804145840.12475A-100000@q8.nrnet.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rich, Dave, Federico ---

Guys, for the assist! The last piece of the puzzle follows.
A buddy of mine in Pennsylvania was able to force the date comparison.
Rich, this is pretty close to your code, a couple of minor diffs
do the job!

SELECT tr_id, tr_date
FROM crtrd1 ALIAS1
WHERE ALIAS1.tr_unit = 'SMA'
AND (ALIAS1.tr_type = 'A' OR ALIAS1.tr_type = 'I')
AND NOT EXISTS(
SELECT tr_id
FROM crtrd1 ALIAS2
WHERE ALIAS2.tr_unit = 'SMA'
AND ALIAS2.tr_id = ALIAS1.tr_id
AND (ALIAS2.tr_type = 'T' OR ALIAS2.tr_type = 'O')
AND ALIAS2.tr_date > ALIAS1.tr_date
)
ORDER BY tr_date DESC;

Thanks for your assistance boys - I'm thinking of getting this
tattooed somewhere - somewhere I can see it when I need it that is!

---------- Sisters of Charity Medical Center ----------
Department of Psychiatry
----
Thomas Good <tomg(at)q8(dot)nrnet(dot)org>
Coordinator, North Richmond C.M.H.C. Information Systems
75 Vanderbilt Ave, Quarters 8 Phone: 718-354-5528
Staten Island, NY 10304 Fax: 718-354-5056

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message SierraAdm 1998-08-04 21:38:21 importing a pre sql db
Previous Message Peter T Mount 1998-08-04 17:48:48 Re: [INTERFACES] JDBC line count in query result