Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select distinct 1

Status
Not open for further replies.

camy123

Programmer
Mar 5, 2004
171
GB
Hi guys
can you help im running a distinct against a column but its still bringing out duplicates ne idea
for example when i run

select disticnt name from table it works fine

but whe i run

select distinct name, creationdate from table
it brings out duplicates

ne idea
Please
 
That is because you are asking for a distinct combination of Name and CreationDate. You obviously have multiple CreationDates for the Name field. What is it you are trying to achieve here.
 
I just want all the data where name is distinct thats all

 
So you are looking for unique "Name" records only?

If so, try this

Code:
Select Name, CreationDate
From Table
Where Name IN (Select Name from Table Group by Name Having Count(*) = 1)
 
your a star cheers mate ,
bingo...... if we could send online prings i would send u one.
cheers again
cam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top