查询语句我想实现类似于逻辑和得效果
SELECT uid,username,taskid from uchome_usertask where taskid=1 and taskid=2
应该怎么改?我这句老是不能调用数据
SELECT uid,username,taskid from uchome_usertask where taskid=1 and taskid=2
应该怎么改?我这句老是不能调用数据
调试欢乐多
from uchome_usertask
where taskid=1 or taskid=2
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
不是只要是1或者是2
uid mediumint(8) UNSIGNED 否 无
username char(15) gbk_chinese_ci 否
taskid smallint(6) UNSIGNED 否 无
credit smallint(6) 否 0
dateline int(10) UNSIGNED 否 0
isignore tinyint(1) 否 0 select * from table where taskid =1 and taskid =2
taskid要同时满足等于1和2的条件
有数据存在,不会是空值
http://www.accessbbs.cn/bbs/viewthread.php?tid=19546
uid username taskid credit dateline isignore
2 xixi 1 20 1248013916 0
2 xixi 2 20 1248014146 0
10 295127910 1 20 1248157313 0
32 游|xuxu 1 20 1248319573 0
34 灰太狼 3 5 1248323431 0 只想获得当taskid同时等于1和2的时候的数据
也就是说,目前只想查询到 xixi 的uid
from 数据表 a ,数据表 b
where a.uid=b.uid
and a.taskid=1
and b.taskid=2
select a.uid,b.uid from test a,test b where a.uid=1 and b.uid=2 and a.uid=b.uid
select a.uid,b.uid from test a,test b where a.uid=1 and b.uid=2
这样就没有问题了
taskid 不能既等于1又等于2