Subquery
返回的值超过1。当subquery
跟随=
,!=
,<
,<=
,>
,>=
或subquery
用作表达式。
select
(SELECT persFName + ' ' + persLName FROM person WHERE persGender = 'M') AS 'Father',
(SELECT persFName + ' ' + persLName FROM person WHERE persGender = 'F') AS 'Mother'
是我的代码,为什么不会输出
答案 0 :(得分:1)
也许就像....
select CASE WHEN persGender = 'M' THEN persFName + ' ' + persLName END AS [Father]
, CASE WHEN persGender = 'F' THEN persFName + ' ' + persLName END AS [Mother]
FROM person
WHERE persGender IN ('M', 'F')