Re: [SQL] locked my keys in the car

Поиск
Список
Период
Сортировка
От Thomas Good
Тема Re: [SQL] locked my keys in the car
Дата
Msg-id Pine.SV4.3.91.980804145840.12475A-100000@q8.nrnet.org
обсуждение исходный текст
Ответ на Re: [SQL] locked my keys in the car  (lynch@lscorp.com (Richard Lynch))
Список 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@q8.nrnet.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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Peter T Mount
Дата:
Сообщение: Re: [INTERFACES] JDBC line count in query result
Следующее
От: chris yambo
Дата:
Сообщение: subscribe pgsql-sql