首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求个SQL查询 在上新手

2012-08-07 
求个SQL查询 在下新手我的查询语句如下:select *,number(select count(id) from et_tea where tea_area2

求个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
143潮州5
153清远2
163江门1
173茂名1
183韶关0


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

id father_id name number
143潮州5
153清远2
163江门1
173茂名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 

热点排行
Bad Request.