I have an access database containing 1 table and need to apply the distinct function which only returns the column selected in the select distinct event statement.
I need to somehow return the other colums and also oder on col 2 which is a date filed dte.
I have tried using group by and group having statement but I get an aggregate error when using the order by.
I am looking for a way to select distinct for the table on event. The join the same table to return the other fields in the same table. Not sure if this is possible. So to recap
It is my understanding that when DISTINCT is used, it applies to all columns selected; so it will find records where the combination of all columns in the select are unique, not just one.
Hi Graham, could you please include the actual query you’re working on when you post questions like this?
Even if it doesn’t work, it might give us an idea of what you’re trying to achieve and where you’re stuck/mistaken.
ok here is the original code but the distinct does not work but it returns the other columns
select distinct event, dte, location
from sports
order by dte
which is the same as
select event, dte, location
from sports
order by dte
other attempts include
select event, min(dte), min(location)
from sports
group by event
which works but does not allow the
order by dte
to function it throws up an error
does not include the specified expression 'dte as part of an aggregate function