Mysql语句改成Oracle语句的区别

 Mysql语句:

          select count(a.site_id) ,
           (select attr_value from site1_attr where site_id = a.site_id and attr_id = '01') as d1 from site1 a
            where 1=1 and site_id in (select site_id from site1_attr where attr_id = '02' and attr_value ='上海')
             group by d1 having count(a.site_id) >=1

 

Oracle语句:

             select count(a.site_id),b.attr_value from site1 a ,site1_attr b where a.site_id = b.site_id and
              a.site_id in (select site_id from site1_attr where attr_id = '02' and attr_value = '上海') and

                 b.attr_value in (select attr_value from site1_attr where attr_id = '01')
                   group by b.attr_value
                    having count(a.site_id) >= 1;

 

 

posted @ 2011-11-03 14:28  Java EE  阅读(205)  评论(0编辑  收藏  举报