当前位置:数据库 > SQLServer >>

关于sqlServer2008的查询语句

补充:select head,exp,nickname from information where userid=(select userid from users where online=1) 我想查询information表中的head,exp,nickname 3列属性,但不是都查,information里有userid列,information只查询userid等于users表中online=1的userid列。能听懂吗? 好像有点乱。 就是说users表和information表都有userid列。我想查询users表中online属性为1的userid,然后通过这些userid再去查询information表中的head,exp,nickname列。这样的语句该怎么写啊?? 因为users表中的online等于1的不止一个,所以我那么查询会报:子查询返回的值不止一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,