私は次のようなクエリがあります
select user_id ,'abc' as user_name from t_user where user_refId=123
、ここにもう1つの句を追加したい
select user_id ,
'abc' as user_name
select count(user) from users as user_num
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
'abc' as user_name
とselect count(user) from users as user_num
ステートメントを区切り、 ","
2 番目のステートメントを のように括弧で囲んでください(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;