Returning ALL fields from a SELECT DISTINCT

  • Hi

    I have a table in which the same name, department etc will appear more than once.

    I can issue a SELECT DISTINCT to find distinct entries but this only returns the fields in teh SELECT list.

    I need to get at the unique ID (primary key) field.  Putting this in the SELECt list means that each row is distinct because the ID is obviously different!

    Any way I can do this?

     

    Many thanks

    Paul

  • You could recast this as a group by query, with every field (except for ID) in the group by clause.  You could then choose to get the Max(ID), Last(ID) (Access syntax), Min(ID) or some such.

    Russel Loski, MCSE Business Intelligence, Data Platform

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply