how do you do this one?
Posted in 1997
Topics: Installation, Setup & Upgrades, SQL Development & Query Writing
I though writing a query for the following problem would be easy. Wrong! I couldn't find how to do it. Can anyone help? Let's say I have a table which represents a status log for a list of computers. The log contains the id of the computer, the status of the computer (say, "up and running","in repair", etc), and the date the status was changed. For each computer, there are several entries with different status types, something like this: computer status Date -------- ----------------------- -------- 1103 Arrived from store 12/01/96 1103 Installed 15/01/96 1103 Stopped Working 22/07/96 2171 Installed 04/08/95 3133 Stopped Working 17/12/96 3133 Repaired 03/01/97 And so on. What I want to get, is the latest status of each computer, i.e. computer status Date -------- ----------------------- -------- 1103 Stopped Working 22/07/96 2171 Installed 04/08/95 3133 Repaired 03/01/97 I want to do this in a single select, without having to create a temporary table or do a subquery (i.e. use "in") for this. Actually I would idealy want to put this in a view, if possible. Any ideas? Thanks, Adi. -- ---------------------------------------------------------------- Adi Lachman phone: (972) 9-9522721 Motorola Semiconductor Israel email: r53837@email.sps.mot.com ---------------------------------------------------------------- -------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to Usenet