Simple Union Query with Max, Group (1 Viewer)

Tskutnik

Registered User.
Local time
Yesterday, 19:00
Joined
Sep 15, 2012
Messages
229
:banghead:UGH! This is so easy and I'm getting syntax errors.
I want to group the Activ_ID and Max the ActivEECO_UpdateDate fields.

SELECT
Activ_ID,
Activ_DatePosted as ActivEECO_UpdateDate
FROM Activity_Translated;

UNION ALL Select
Activ_ID,
ActivEECO_UpdateDate
FROM ActivityEECO_Translated;

Please help.
Thanks
 

plog

Banishment Pending
Local time
Yesterday, 18:00
Joined
May 11, 2011
Messages
11,646
You posted the SQL of a query. Save that query with the name 'sub1'. Then use this SQL to achieve what you want:


Code:
SELECT Activ_ID, MAX(ActivEECO_UpdateDate) AS LastDate FROM sub1

A UNION query should only be used to bring data together. When you want to do more, save the UNION then use it as the basis for another query.
 

Users who are viewing this thread

Top Bottom