Home » SQL & PL/SQL » SQL & PL/SQL » Improvement over the Query needed.
Improvement over the Query needed. [message #2830] Thu, 15 August 2002 22:54 Go to next message
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))
Re: Improvement over the Query needed. [message #2859 is a reply to message #2830] Sat, 17 August 2002 08:31 Go to previous message
Abul Fazal
Messages: 39
Registered: February 2002
Member
Query Tuning & Optimization are very huge concepts. Suggest u read up something & come out with u'r own ideas.
Previous Topic: Index, Please reply ASAP.
Next Topic: New Oracle student
Goto Forum:
  


Current Time: Thu Apr 25 15:02:07 CDT 2024