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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Simple DISTINCT Question

Author  Topic 

Firebrand
Starting Member

24 Posts

Posted - 2010-06-25 : 08:56:45
Hello everyone,

I'm returning data successfully with the following Query:

SELECT o.LanguageID, c.CountryID, o.CountryLanguageID, l.LanguageName, l.LanguageCode
FROM ((tblCountries AS c INNER JOIN tblLanguageOrder as o ON o.CountryID = c.CountryID)
INNER JOIN tblLanguages AS l ON l.LanguageID = o.LanguageID)
WHERE c.DomainURL = 'www.firebrandtraining.dk'
ORDER BY o.LanguageOrderID

I'd like to return a set of results that are DISTINCT based on the o.LanguageID column. I've tried DISTINCT and a RIGHT JOIN approach but with no success.

I'm thinking this can't be that difficult as it's probably not an unusual request.

Many Thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-25 : 09:07:51
Give sample data and wanted output please.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Firebrand
Starting Member

24 Posts

Posted - 2010-06-25 : 10:50:23
quote:
Originally posted by webfred

Give sample data and wanted output please.


No, you're never too old to Yak'n'Roll if you're too young to die.



I've managed to sort this out. I had too many columns for the row to be DISTINCT. Thanks for your help.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-25 : 10:54:38
Just a guess:
While working on sample data and wanted output you have seen clear what the problem was


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-06-28 : 05:03:53
quote:
Originally posted by webfred

Just a guess:
While working on sample data and wanted output you have seen clear what the problem was


No, you're never too old to Yak'n'Roll if you're too young to die.



Very correct

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page
   

- Advertisement -