Click to See Complete Forum and Search --> : how to use distinct with order by?


johnix
01-15-2009, 02:56 AM
i have this query:

select distinct top 10 Event_Name, ID from Event where showType = '1' order by ID DESC

out put:

test
Name: ID:
hello 14484
test 14485
test 14486
test 14487
test 14488
test 14489
test 14490
test 14491
range 14492

i want to distinct the name col only.
can anybody help me?

chazzy
01-15-2009, 07:31 AM
maybe use MAX(ID) or MIN(ID) w/ a GROUP BY EVENT_NAME ?

johnix
01-15-2009, 08:25 AM
thanks chazzy. i just add order by and i got it.