Tuesday, 3 September 2013

group by while selecting many more columns

group by while selecting many more columns

I have this query :
select first_name, last_name, MAX(date)
from person p inner join
address a on
a.person_id = p.id
group by first_name, last_name
with person(sid, last_name, first_name), address(data, cp, sid, city)
My question is how I can have a query that select first_name, last_name,
MAX(date), city, cp without adding city and cp to the group
I mean I want to have all 5 columns but only for the datas grouped by
first_name, last_name and date
Many Thanks

No comments:

Post a Comment