| Author: Tejinder Singh Barnala 31 Dec 2008 | Member Level: Gold | Rating:  Points: 2 |
yes,
for example you can go like
select distinct name, class, title from testtable
this query will perform commulative distinct operation on name, class and title column.
hope it will help you
Many Thanks Tejinder Singh Barnala /*I have the simplest tastes. I am always satisfied with the best*/
|
| Author: Gaurav Agrawal 31 Dec 2008 | Member Level: Diamond | Rating:  Points: 3 |
use this query
select distinct id,name,address,mobile,email from table
it gives u all distinct values and if it not worked properly then try this
select distinct(name),id,address,mobile,email from (select distinct(id),name,address,mobile,email from table) as tbl
it will helps u......
GA
Thanks & Regards,
Gaurav Agrawal Sr.Software Engineer gaur1982@yahoo.com 09829373514
|
| Author: ani 31 Dec 2008 | Member Level: Gold | Rating:  Points: 5 |
hi
You Can Do Distinct on multiple columns by using order by..
Example: DEPTNO LOC JOB SAL ENAME ---------- ------------- --------- ---------- ---------- 10 NEW YORK CLERK 1300 MILLER 10 NEW YORK MANAGER 2450 CLARK 10 NEW YORK PRESIDENT 5000 KING 20 DALLAS ANALYST 3000 FORD 20 DALLAS ANALYST 3000 SCOTT 20 DALLAS CLERK 800 SMITH
select * from table_name j order by deptno,loc,job,sal,ename
output is like this
DEPTNO LOC JOB SAL ENAME ---------- ------------- --------- ---------- ---------- 10 NEW YORK CLERK 1300 MILLER MANAGER 2450 CLARK PRESIDENT 5000 KING 20 DALLAS ANALYST 3000 FORD 3000 SCOTT 800 SMITH
regards ani
|
| Author: rahulagrawal 31 Dec 2008 | Member Level: Silver | Rating:  Points: 0 |
yes
|
| Author: Tejinder Singh Barnala 31 Dec 2008 | Member Level: Gold | Rating:  Points: 2 |
any, what u writting dear, i don't think this query will genrate output which u have mentioned in SQL Server.
on other DBMS i don't know, atleast it will not genrate required result on sql server.
/*hope this is typing mistake from ur side*/
Many Thanks Tejinder Singh Barnala /*I have the simplest tastes. I am always satisfied with the best*/
|
| Author: Tejinder Singh Barnala 31 Dec 2008 | Member Level: Gold | Rating:  Points: 2 |
what yes rahul, r u saying ani's query is correct one for this scenrio, if this, then i think you have to check result of this query by executing it on your sql server.
Many Thanks Tejinder Singh Barnala /*I have the simplest tastes. I am always satisfied with the best*/
|
| Author: ani 31 Dec 2008 | Member Level: Gold | Rating:  Points: 1 |
hi Tejinder thanks .. You are correct this is applicable in “Advanced Oracle SQL Programming”.. Thanks for Your correction..
regards ani
|
| Author: Tejinder Singh Barnala 31 Dec 2008 | Member Level: Gold | Rating:  Points: 1 |
thanks ani, thanks for your reply, actualy i have never worked on oracle, so i don't know in oracle how it works.
Thanks again
Many Thanks Tejinder Singh Barnala /*I have the simplest tastes. I am always satisfied with the best*/
|
| Author: Preet 31 Dec 2008 | Member Level: Gold | Rating:  Points: 2 |
Many thanks to all of you for your replies but i did not get the solution of my question.
I tried using what Tejinder suggested but did not get the result i wanted.
Regards
|
| Author: Tejinder Singh Barnala 31 Dec 2008 | Member Level: Gold | Rating:  Points: 1 |
just paste sample of your input and output you want, i will give you solution for that.
Many Thanks Tejinder Singh Barnala /*I have the simplest tastes. I am always satisfied with the best*/
|
| Author: www.DotNetVJ.com 02 Jan 2009 | Member Level: Diamond | Rating:  Points: 1 |
HI DISTINCT is applicable to all the columns in SELECT clause.
Thanks -- Vj http://dotnetvj.blogspot.com
Thanks -- Vijaya Kadiyala http://www.DotNetVJ.com Microsoft MVP Me & My Little Techie
|
| Author: Sujina 03 Jan 2009 | Member Level: Gold | Rating:  Points: 1 |
Hi
Yes,it is possible by using the keyword distinct followed by columnnames in the select query.
|
| Author: Karthik 06 Jan 2009 | Member Level: Gold | Rating:  Points: 1 |
Hai,
can you give me some sample output? i can help you.
Rgagards, Karthik
|
| Author: Preet 06 Jan 2009 | Member Level: Gold | Rating:  Points: 3 |
There are 3 columns in my dataBase retrieved after applying query, Now I want to populate my first dropDownList with distinct values from first columns, 2nd with 2nd distinct and third with 3rd distinct value..........
Is is possible to acheive this with single distinct, which now i think is not.
|