Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 8

Qt-interest Archive, March 2002
[OT]: Complex query


Message 1 in thread

I've got an Oracle table and I need to perform
a complex query on it, but I'm not sure how
to formulate it.

This is what I need to do:

select id,tcc_cn,TO_CHAR(entered, 'dd-Mon-yyyy'),
TO_CHAR(updated, 'dd-Mon-yyyy'),enteredby,num_bump,
status FROM book_hold WHERE

1) There are no books with the tcc_cn that already
have a status of 'NOTIFIED'.
2) Its updated date is the MIN(updated) for that
tcc_cn.

So, for example, if I have the following items:

tcc_cn   updated   status
-------------------------
990227   03-08-02  WAITING
990227   03-10-02  WAITING
990228   03-08-02  WAITING
990228   03-15-02  NOTIFIED

I would get information back for
this item:

990227   03-08-02  WAITING

Is there a good way to do this in one or
two queries?

Any tips would be most appreciated. Thanks
in advance!

Jeff "Shippy" Shipman     E-Mail: shippy@nmt.edu
Computer Science Major    ICQ: 1786493
New Mexico Institute of Mining and Technology
Homepage: http://www.nmt.edu/~shippy