日期:2014-05-18  浏览次数:20415 次

求个SQL查询 在下新手
我的查询语句如下:
select *,number=(select count(id) from et_tea where tea_area2=et_city.id) from et_city where father_id=3

查询结果为:

id father_id name number
14 3 潮州 5
15 3 清远 2
16 3 江门 1
17 3 茂名 1
18 3 韶关 0


我要的结果是这样: 把number 为0的不要

id father_id name number
14 3 潮州 5
15 3 清远 2
16 3 江门 1
17 3 茂名 1

谁来帮一下 谢谢啦

------解决方案--------------------
SQL code


select * from (
    select *,
        number=(select count(id) from et_tea where tea_area2=et_city.id ) 
    from et_city where father_id=3
) tmp where number>0