求一段SQL 代码

谁学逆向工程 2017-10-27 05:46:19
在 tbGoods 表中有三列
1、GoodsName
2、BaseBarCode
3、SalePrice

1是商品名称,2是商品条码,3是售价


大米和淀粉的条码都是7位(len(BaseBarCode)=7 )
现在只要在大米和淀粉中查询(GoodsName Like '%大米%' GoodsName Like '%淀粉%' )
查出哪些大米的售价等于淀粉
...全文
105 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
FainSheeg 2017-10-27
  • 打赏
  • 举报
回复
select * from tbgoods where (goodsname like '%大米%' or goodsname like '%淀粉%') and saleprice in(select saleprice from tbgoods where goodsname like '%大米%' and saleprice in(select saleprice from tbgoods where goodsname like '%淀粉%')) order by saleprice,goodsname
谁学逆向工程 2017-10-27
  • 打赏
  • 举报
回复
引用 1 楼 yangliu0512 的回复:
select * from tbgoods where goodsname like '%大米%' and saleprice in(select saleprice from tbgoods where goodsname like '%淀粉%')
对应的等价的淀粉没出来啊
FainSheeg 2017-10-27
  • 打赏
  • 举报
回复
select * from tbgoods where goodsname like '%大米%' and saleprice in(select saleprice from tbgoods where goodsname like '%淀粉%')

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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