日期:2014-05-17  浏览次数:20396 次

求sql语句……
有三个表User(客户表),Examine(审核表),Admin(审核员表)。我想查公司审核员审核过的客户信息。
我先是这样写的:
selct *from User where and UserId=(
  select UserId from Examine where IsExam='1' AdminId=(
  select AdminId from Admin
  )
  )。

即 先查所有的审查员AdminId,再查所有审查员审查过的UserId,最后查客户的信息。但提示“子查询的返回值不止一个。当

子查询跟随在=、!=、<、<=、>、>=之后,后子查询用作表达式时,这种情况不允许的。”所以我想我可以先查公司审核员的

AdminId,放在一个临时表中,即select AdminId into #Exam from Admin ,然后用sql的while循环语句,查询每个审核员审

核过的客户信息,(IsExam='1'表示审核过的)直到AdminId=null,最后得到一个结果集

UserId UserName Sex Age Phone AdminId ,求sql语句!!!


------解决方案--------------------
楼上正解