Improvement over the Query needed. [message #2830] |
Thu, 15 August 2002 22:54 |
pkmicf
Messages: 18 Registered: August 2002
|
Junior Member |
|
|
I have a table called table1 with the following fields:
itemno, podate, rate
I want to find the latest podate and highest rate for the given item (say 1). I have a solution for this below.
Is there any way to improve this query and here I used itemno=1 four times. Please help.
Query:-
-----
SELECT *
FROM Table1
WHERE itemno=1
and podate in (select max(podate) from table1 where itemno=1)
and rate in (select max(rate) from table1 WHERE itemno=1 and podate in (select max(podate) from table1 where itemno=1))
|
|
|
|