-1

我有一个像这样的查询

select user_id ,'abc' as  user_name from t_user where user_refId=123 

,我想在这里再添加一个子句,例如

select user_id ,
'abc' as  user_name
select count(user) from users as user_num
 from t_user where user_refId=123 

这行不通。

4

2 回答 2

1
select user_id,
      'abc' as user_name, 
       (select count(user) from users)  as user_num
from t_user 
where user_refId=123 
于 2012-06-21T08:10:07.100 回答
0

请将'abc' as user_nameandselect count(user) from users as user_num语句分开,","并将第二个语句放在括号中,如(select count(user) from users) as user_num.

      select user_id,
      'abc' as user_name, 
       (select count(user) from users)  as user_num
       from t_user where user_refId=123;
于 2012-06-21T08:14:51.890 回答