Hello,
I have the following query problem. Consider the following table (field names and content):
Code, Name, OtherInfo
A1, Peter, Soandso
A2, Paul, Blabla
A1, Mary, Othertext
A1, Jack, Otherstuff
What I'd like to get back from my query is:
A1, Peter, Soandso
A2, Paul, Babla
In other words: I want to do a SELECT DISTINCT on the Code field, but still bring up the other fields in the table. As to name, it should bring up the First one, and for OtherInfo, it should just bring up the one which is associated with the first name.
Intuitively you would think that something like that should work:
SELECT Code, First(Name), OtherInfo
FROM Table
GROUP BY Code
Unfortunately it doesn't, as the Group By requires all fields to have an aggregate function ...
Any advice?
Many thanks
I have the following query problem. Consider the following table (field names and content):
Code, Name, OtherInfo
A1, Peter, Soandso
A2, Paul, Blabla
A1, Mary, Othertext
A1, Jack, Otherstuff
What I'd like to get back from my query is:
A1, Peter, Soandso
A2, Paul, Babla
In other words: I want to do a SELECT DISTINCT on the Code field, but still bring up the other fields in the table. As to name, it should bring up the First one, and for OtherInfo, it should just bring up the one which is associated with the first name.
Intuitively you would think that something like that should work:
SELECT Code, First(Name), OtherInfo
FROM Table
GROUP BY Code
Unfortunately it doesn't, as the Group By requires all fields to have an aggregate function ...
Any advice?
Many thanks