我有表AA
和列
值A B C
1,a,a
表BB
,A,B,C
,其值为2,b,b
如果我select B=a and C=a
我希望将o / p作为具有值A
的列1
或
如果我select B=b and C=b
我希望获得值为A
2
我想要单一查询
答案 0 :(得分:2)
(SELECT a FROM AA WHERE B = 'something' AND C = 'something')
UNION ALL
(SELECT a FROM BB WHERE B = 'something' AND C = 'something')