Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
eashoori
Starting Member
22 Posts |
Posted - 2007-09-27 : 10:47:17
|
I want to select 2 different fields in a statment but I need both of them to return non recurring recoirds, how can I distinct both on the same statement? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-27 : 10:49:11
|
SELECT DISTINCT Col1, Col2FROM Table1 E 12°55'05.25"N 56°04'39.16" |
 |
|
eashoori
Starting Member
22 Posts |
Posted - 2007-09-27 : 11:54:49
|
No I mean if I want single occujrance on both fields, meaning distinct on each field, the previous one distinct all the fields together, it gives me the distinct rows of all of them together |
 |
|
cat_jesus
Aged Yak Warrior
547 Posts |
Posted - 2007-09-27 : 12:25:22
|
Keep in mind that I'm guessing a bit as your requirements are incredibly vagueselect distinct '' as col1, col2 from table1union allselect distinct col1, '' as col2 from table1Of course you provided no schema and no data to work with so I'm not sure what you're really looking for.Hopefully this helps. |
 |
|
cat_jesus
Aged Yak Warrior
547 Posts |
Posted - 2007-09-27 : 12:29:57
|
Or if you want to be fancyselect A.Col1, B.Col2 from (select distinct (Col1) from Table1) as Afull join(select distinct (Col2) from Table1) B on 1=2 |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-27 : 13:14:19
|
Do you have some proper and accurate sample data together with your expected result? E 12°55'05.25"N 56°04'39.16" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-09-28 : 02:50:24
|
quote: Originally posted by eashoori No I mean if I want single occujrance on both fields, meaning distinct on each field, the previous one distinct all the fields together, it gives me the distinct rows of all of them together
Did you mean Suppress if duplicated?As asked, post some sample data with expected resultMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|