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;

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2021-12-29
  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-01
  • 2021-05-28
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
  • 2021-09-15
相关资源
相似解决方案