Home » SQL & PL/SQL » SQL & PL/SQL » query
query [message #277110] Mon, 29 October 2007 00:03 Go to next message
msafana
Messages: 31
Registered: July 2007
Member
hi all,
i want to display distinct values of 2 columns in single qeury.
for example,if i want to see the unique values of 2 columns like job_id and job_title then how we write the query.

Thank u
Re: query [message #277114 is a reply to message #277110] Mon, 29 October 2007 00:09 Go to previous messageGo to next message
Arju
Messages: 1554
Registered: June 2007
Location: Dhaka,Bangladesh. Mobile:...
Senior Member

What you have tried?
Re: query [message #277115 is a reply to message #277114] Mon, 29 October 2007 00:15 Go to previous messageGo to next message
msafana
Messages: 31
Registered: July 2007
Member
select distinct job_id,job_title from departments;
Re: query [message #277120 is a reply to message #277115] Mon, 29 October 2007 00:30 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And is this or not what you want? Why?

In addition, read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Always post your Oracle version (4 decimals).

Regards
Michel
Re: query [message #277137 is a reply to message #277110] Mon, 29 October 2007 01:34 Go to previous messageGo to next message
msafana
Messages: 31
Registered: July 2007
Member
iam getting the result related to first column,it is not giving the distinct values of second column,is my query is right?
Re: query [message #277154 is a reply to message #277137] Mon, 29 October 2007 02:12 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Post (copy and paste an execution) what you get and why this is not what you want.

Regards
Michel
Re: query [message #277177 is a reply to message #277137] Mon, 29 October 2007 02:51 Go to previous message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
msafana wrote on Mon, 29 October 2007 07:34

iam getting the result related to first column,it is not giving the distinct values of second column,is my query is right?


DISTINCT is applied to the whole column list [SELECT statement: Specify DISTINCT or UNIQUE if you want the database to return only one copy of each set of duplicate rows selected].

In other words, you can not specify something like
select job_id, distinct job_title from departments;

or 

select distinct job_id, distinct job_title from departments;
in order to select 'distinct second column' or 'distinct all columns'.
Previous Topic: Showing "Insufficient Privileges" while executing DBMS_AQL.LISTEN
Next Topic: Regional Settings
Goto Forum:
  


Current Time: Sun Dec 04 18:49:48 CST 2016

Total time taken to generate the page: 0.05392 seconds