Note I always want to return all columns and not only those that are defined as distinct I have a table lets call it Foo with these columns DeviceId, TransactionId, IndetId, Datetime, SalesId, and Quantity and some more columns
If I have rows that are identical for columns DeviceId, TransactionId, IndetId, Datetime, SalesId I want to select only the first row and skip the rest.
An example
DeviceId TransactionId IndetId Datetime SalesId Quantity
123 10 8 2022-12-12 700 45
123 10 8 2022-12-12 700 75
In this example only the first row should be returned.
I can't use a simple distinct because I need all columns to be returned
I had hoped that the syntax for doing this should be something like this. Telling sql to use distinct only on these columns. SELECT distinct(DeviceId, TransactionId, IndetId,Datetime, SalesId), Quantity FROM Foo
If I do SELECT distinctDeviceId, TransactionId, IndetId, Datetime, SalesId FROM Foo then I miss a lot of columns and the result will be wrong