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
 how to select distinct on one column

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2015-04-15 : 18:10:04
HI i have this
SELECT DISTINCT inta, name, PHN#, fROM nydta.adres
WHERE inta <> ' '

I want the distinct for inta because alot of the time phone is blank so those are coming thru i do want all columns, but distinct for inta.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-04-15 : 18:11:30
You can use the ROW_NUMBER() function for this.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -