2008年8月20日 星期三

sql 子查詢

為了找出該年、該

季,是否有重覆挑選的款式

select main_id,kind,style_id from sfp_meeting_temp where main_id in (select id from sfp_meeting where year ='2008' and locked is null);

 

Steven指導 =>

SELECT a.id,b.id,a.main_id,a.kind,a.style_id from sfp_meeting_temp a,sfp_meeting_temp b where a.kind=b.kind and a.style_id=b.style_id and a.id!=b.id and a.main_id in (select id from sfp_meeting where year ='2008' and season='Fall'and locked is null) order by a.kind,a.style_id  ;

0 意見: