查询执行问题

时间:2012-06-21 08:07:18

标签: sql oracle

我有一个像

这样的查询
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 

这不成功。

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

请在'abc' as user_name之间分隔select 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;