请教一个SQL语句关于查询显示超过指定数量的明细
A(客户编号,次数,商品,经办人,时间,数量)—— 客户编号和次数会重复出现 就是客户一次可以拿多种商品
B(商品,标记) 标记为1或者0
A 、B表用过商品关联 表中其他不重要的字段省略了
我要查询指定时间内在A表中同一客户编号同一次数超过三种在B表中标记为1的数据明细
求方法
相关推荐
sql 语句实现数据库数据的更新查询.docx
。
sql语句查询指定的条数
查询指定的数据条数,如Oracle、MySQL、sqlserver等
SQL查询语句大全集锦(超经典)
SQL查询语句大全集锦(超经典)
使用sql语句查询日期
使用sql语句查询日期 select * from ShopOrder where datediff(week,ordTime,getdate()-1)=0 //查询当天日期在一周年的数据 select * from ShopOrder where datediff(day,ordTime,getdate()-1)=0 //查询当天的所有数据 --查询当天: select * from info where DateDiff(dd,datetime,getdate())=0
SQL语句,查询当月,当年数据
当月数据 select * from table t where t.create_time >=TRUNC(SYSDATE, 'MM') and t.create_time=trunc(sysdate,'YYYY') and t.create_time=trunc(sysdate,'day')+1 and t.create_time=trunc(next_day(sysdate-8,1)+1) and t.create_time<=trunc(next_day(sysdate-8,1)+7) select trunc(next_day(sysdate - 8, 1) + 1) as 周一, trunc(next_day(sysdate - 8, 1) + 2) as 周二, trunc(next_day(sysdate - 8, 1) + 3) as 周三, trunc(next_day(sysdate - 8, 1) + 4) as 周四, trunc(next_day(sysdate - 8, 1) + 5) as 周五, trunc(next_day(sysdate - 8, 1) + 6) as 周六, trunc(next_day(sysdate - 8, 1) + 7) as 周日 from dual;


基础和管理
