做后台数据统计想按时间段分开统计结果输出使用select count(*) as sum,time from track where time = 123456789 or time = 987654321查询时,如果表中不存在time为指定的值时会返回null,如何让其返回查询条件里的值,比如让其显示为:sum time
0 123456789
0 987654321
x .........而不是sun time
0 NULL求高手`
0 123456789
0 987654321
x .........而不是sun time
0 NULL求高手`
select 123456789 as time union all select 987654321
( b where a.time = b.time
group by b.time
参考一下这个贴子的提问方式http://bbs.csdn.net/topics/320211382
1. 你的 create table xxx .. 语句
2. 你的 insert into xxx ... 语句
3. 结果是什么样,(并给以简单的算法描述)
4. 你用的数据库名称和版本(经常有人在MS SQL server版问 MySQL)
这样想帮你的人可以直接搭建和你相同的环境,并在给出方案前进行测试,避免文字描述理解上的误差。
当您的问题得到解答后请及时结贴.
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
http://bbs.csdn.net/help#post_dispose