Select DISTINCT - selecting two fields

naminder

Registered User.
Local time
Today, 14:52
Joined
Aug 8, 2005
Messages
41
Hi

I am trying to use a query to populate a combo box. works fine as I am using one table. I want to select DISTINCT records which works. However i need the ID of that record in the select statement. Anyone know how to select two things in a select distinct query??

Select DISTINCT tbl_Aplaws.Level2 FROM tbl_Aplaws WHERE tbl_Aplaws.Level1 = 'Business' ORDER BY tbl_Aplaws.Level2;

this works. but i need to select the tbl_Aplaws.AplawID as well. throws errors
 
what a headache. i managed to find out that you can only use one select field in a select distinct.

i came up with some different code that helps me do what i want.

here for ref

SELECT tbl_Aplaws.Level1, First(tbl_Aplaws.AplawID) AS FirstOfAplawID
FROM tbl_Aplaws
GROUP BY tbl_Aplaws.Level1;
 

Users who are viewing this thread

Back
Top Bottom