infobright in子查询问题

aaron0768 2013-11-29 07:00:30
我用相同的语句,用in子查询,得到的结果会变的(数据表已经固化的)。
select count(distinct uid) from userLogin where gameId='1375682963962790' and dateTime=UNIX_TIMESTAMP('20131030')
and uid in(
SELECT DISTINCT uid from r_game_new_user where gameId='1375682963962790' and dateTime=UNIX_TIMESTAMP('20131029')
);

把表结构改成myisam或者使用联表,就不会有问题
...全文
122 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
aaron0768 2013-12-02
  • 打赏
  • 举报
回复
@hdhai9451 1、使用联表得到的结果是正确的,但是用in就不对,就想问为什么 2、datetime是天0点时间戳,UNIX_TIMESTAMP是把字符串日期转成时间戳
Andy__Huang 2013-11-29
  • 打赏
  • 举报
回复
不知道你上面的datetime是不是字段?还有函数UNIX_TIMESTAMP()转换的结果是什么?
Andy__Huang 2013-11-29
  • 打赏
  • 举报
回复


select count(distinct a.uid) 
from userLogin a
inner join r_game_new_user b on a.uid=b.uid and a.gameId=b.gameId
where a.gameId='1375682963962790' and a.dateTime=UNIX_TIMESTAMP('20131030') and b.dateTime=UNIX_TIMESTAMP('20131029')

22,210

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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