a表 字段id,name,wei_id,sex,age,c_cardid 。b表字段code,date,goods
a.id不重复,b.code=a.id中的数值可重复
select a.id,a.name from a
where a.weixin_id is not null and (c_cardid between '00000001' and '99999999')
and a.id in(select b.code from b where b.date between '2016-11-10 13:00:00.000'and '2016-11-11 13:00:00.000' )
查询a.wei_id不为空值时b中某时间段的数据
要求同时显示a,b的数据
即显示为
a.id | a.name | b.date | b.goods
a.id不重复,b.code=a.id中的数值可重复
select a.id,a.name from a
where a.weixin_id is not null and (c_cardid between '00000001' and '99999999')
and a.id in(select b.code from b where b.date between '2016-11-10 13:00:00.000'and '2016-11-11 13:00:00.000' )
查询a.wei_id不为空值时b中某时间段的数据
要求同时显示a,b的数据
即显示为
a.id | a.name | b.date | b.goods
解决方案 »
- 视图BETWEEN
- 关于删除记录的问题,在线等,急....
- 如何用一张表的值去update另一张表的值?
- 求一字符串?如何截取?
- 使用Java程序连接ms sql server 2000, JDBC连接方式失败,而ODBC连接方式成功。请问如何是JDBC连接模式也能成功
- 在线等,100分散尽求一行注释(15字以内)
- 企业管理器显示0.3984,查询分析器数据显示的是0.398399999999999,这是怎么回事,高手来解决一下啊
- 由于I/O错误导致数据库置疑,错误日志中提示升级数据库失败(950错误)
- 数据恢复问题,答对即给分(在线)
- vb连sqlserver经常出现超时错误
- 遇到 cannot find one or more components please reinstall ,怎么办
- 搜索出符合条件的最后一条
a.name ,
b.date ,
b.goods
FROM a
INNER JOIN b ON a.id = b.code
AND b.date BETWEEN '2016-11-10 13:00:00.000'
AND '2016-11-11 13:00:00.000'
WHERE a.weixin_id IS NOT NULL
AND ( a.c_cardid BETWEEN '00000001' AND '99999999' );