Re: query within query
This gives me the right records, in order, one of each required, but shows the oldest statdate data rather than the most recent...
- produces similar results with or without the left join.
select
s.site_id,
s.site_name,
DATE_FORMAT(s1.date,'%d %M %Y') as statdate,
from
cp_SITEs as s
INNER JOIN cp_STATs s1 using ( site_id )
left join cp_STATs as s2 on s.site_id=s2.site_id and s1.date > s2.date
where
s.parent_id= 1
group by
s1.site_id
order by
s1.site_id asc, s1.date desc
Subject
Written By
Posted
Re: query within query
April 07, 2006 06:15PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.