M
MacDuff
Hello
Is there a way to group the fields in a select SELECT DISTINCT statement so
that the distinct part works only with the first three fields and the
additional 4th field (event_id) and is always unique is also returned.
SELECT DISTINCT organization, tod, location, event_id FROM events
the event_id field is unique in all records, so selecting as shown causes
all records to be returned.
I need to use DISTINCT as the return data is used to populate a list which
serves as a template for new records. I do not wish duplicate entries in
the template list.
If event_id could be grouped outside the distinct organization, tod,
location part of the select statement then only those records that have
uniquely different fields would be returned. The return of the fourth
field, would enable me edit and update a returned record since I would have
a unique key value for the update command.
Is there a way to group the fields in a select SELECT DISTINCT statement so
that the distinct part works only with the first three fields and the
additional 4th field (event_id) and is always unique is also returned.
SELECT DISTINCT organization, tod, location, event_id FROM events
the event_id field is unique in all records, so selecting as shown causes
all records to be returned.
I need to use DISTINCT as the return data is used to populate a list which
serves as a template for new records. I do not wish duplicate entries in
the template list.
If event_id could be grouped outside the distinct organization, tod,
location part of the select statement then only those records that have
uniquely different fields would be returned. The return of the fourth
field, would enable me edit and update a returned record since I would have
a unique key value for the update command.