2012-06-21 97 views
-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 

這是行不通的。

+3

它以什麼方式「不鍛鍊」?我們不是心靈感應。請給我們一些細節:描述觀察到的行爲,包括任何錯誤消息。幫助我們來幫助你。 – APC

回答

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

請通過","分離'abc' as user_nameselect 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; 
+0

我有這些,仍然得到ORA-00923:FROM關鍵字找不到預期的地方 00923. 00000 - 「FROM關鍵字找不到預期的地方」 *原因: – harqs