我想在以查询的基础上加一这么一个条件怎么加呀

longshenwang 2006-03-29 03:44:53
我想在以查询的基础上加一这么一个条件怎么加呀
想加的条件如下:
b.zbxh(序号)相同的,同一个h.zlcc(质量层次),品种h.brand>=3种的所有记录显示出来
查询语句如下:
select b.zbxh,d.chinaname,d.chinaspec,e.unitname,h.brand,h.Produce_Factory,
h.Minpacking,h.zlcc,h.qtsm,h.Elucidation,g.Enterprisename,a.bidid,c.auditing,
c.id,d.typeid, c.jionproduct, a.drexpertid, h.Newprice, c.lastprice, c.price
from
drexpert_type a ,
bid_product b ,
user_product c ,
product_basic d ,
unit e ,
bid_user f,
EnterpriseBasicInfor g ,
product_qt h,[user] i
where
g.userid=i.userid
and a.bidid=b.bidid and c.bidid=b.bidid
and c.productqtID=h.id and d.id=h.basicid and b.product_basicid=d.id and
d.typeid=a.bid_typeid and d.unitid= e.id and f.bidid = b.bidid AND c.userid = f.id and
f.userid=i.userid and a.bidid=63 and c.auditing=1 and f.usertype=1 and a.drexpertid=88
...全文
105 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhurenweile 2006-03-29
  • 打赏
  • 举报
回复
试过了,楼上的不对
子陌红尘 2006-03-29
  • 打赏
  • 举报
回复
try:
------------------------------------------------------------------------------------------------------------------------------------
select b.zbxh,d.chinaname,d.chinaspec,e.unitname,h.brand,h.Produce_Factory,
h.Minpacking,h.zlcc,h.qtsm,h.Elucidation,g.Enterprisename,a.bidid,c.auditing,
c.id,d.typeid, c.jionproduct, a.drexpertid, h.Newprice, c.lastprice, c.price
from
drexpert_type a ,
bid_product b ,
user_product c ,
product_basic d ,
unit e ,
bid_user f,
EnterpriseBasicInfor g ,
product_qt h,[user] i
where
g.userid=i.userid
and a.bidid=b.bidid and c.bidid=b.bidid
and c.productqtID=h.id and d.id=h.basicid and b.product_basicid=d.id and
d.typeid=a.bid_typeid and d.unitid= e.id and f.bidid = b.bidid AND c.userid = f.id and
f.userid=i.userid and a.bidid=63 and c.auditing=1 and f.usertype=1 and a.drexpertid=88
and (select
count(distinct hh.brand)
from
bid_product bb,user_product cc,product_qt hh
where
bb.bidid=cc.bidid and cc.productqtID=hh.id and bb.zbxh=b.zbxh and hh.zlcc=h.zlcc)>=3

34,593

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧