Home » RDBMS Server » Server Administration » Distinct and Order by
Distinct and Order by [message #372026] Thu, 04 January 2001 16:59 Go to next message
SD
Messages: 16
Registered: March 2000
Junior Member
I have the following query with the following output:

select a.tech_spec_group_id, b.heading, a.priority
from tech_spec a,
tech_spec_group_info b
where a.tech_spec_group_id=b.tech_spec_group_id
and a.priority < 6
and a.product_group_id=286
and b.lang_id = 10
order by a.priority

ID HEADING PRIORITY
----- ------------------------------ ---------
292 Engine 1
292 Engine 2
292 Engine 3
295 Weights 4
294 Operating Specifications 5

I need to write a query to get the following output

ID HEADING
-------- ------------------------------
292 Engine
295 Weights
294 Operating Specifications

Please note that the about result (ID Column )should be still ordered on priority but need not have to selected in the SELECT clause. I do know about the NOPRINT option in SQL*PLUS but I am more interested through SQL.

Any help and ideas would be greatly appreciated.

SD
Re: Distinct and Order by [message #372030 is a reply to message #372026] Fri, 05 January 2001 01:34 Go to previous message
GK
Messages: 22
Registered: January 2001
Junior Member
hey what if u have a condition like this

ID HEADING PRIORITY
----- ------------------------------ ---------
292 Engine 1
292 Engine 2
292 Engine 3
295 Weights 4
294 Operating Specifications 5
292 Engine 6

should this also be retrieved like

ID HEADING
-------- ------------------------------
292 Engine
295 Weights
294 Operating Specifications

or like
ID HEADING
-------- ------------------------------
292 Engine
295 Weights
294 Operating Specifications
292 Engine
Previous Topic: How to find the Size of the Database? - Urgent.
Next Topic: max length of oracle query
Goto Forum:
  


Current Time: Thu May 16 23:32:57 CDT 2024