Hi, all - I have a one-to-many query which I would like to add a subquery to eliminate all but the TOP 1 of a field.
Here is the SQL:
And I would like to only show the TOP 1 of the SiteKey field. I have been googling my fingers off but SQL hurts my head!
So, I think I have to add the subquery before the ORDER BY, but can't quite wrap my head around it.
Any assistance would be appreciated; thanks!
Here is the SQL:
Code:
SELECT QrySitesBatteries.SiteKey, QrySitesBatteries.SITEID, QrySitesBatteries.Battery
FROM QrySitesBatteries
WHERE (((QrySitesBatteries.Battery)=[Forms]![FMHome]![Battery])) OR ((([Forms]![FMHome]![Battery]) Is Null))
ORDER BY QrySitesBatteries.SITEID;
And I would like to only show the TOP 1 of the SiteKey field. I have been googling my fingers off but SQL hurts my head!

So, I think I have to add the subquery before the ORDER BY, but can't quite wrap my head around it.
Any assistance would be appreciated; thanks!