Hrs
Hrs

Reputation: 11

select from multiple tables

I have table AA with Columns A B C with values 1,a,a

Table BB with A,B,C with values 2,b,b

if i select B=a and C=a i want to get o/p as Column A with Value 1

or

if i select B=b and C=b i want to get o/p Column A with Value 2

I want single query for this

Upvotes: 1

Views: 211

Answers (1)

Dan Grossman
Dan Grossman

Reputation: 52372

(SELECT a FROM AA WHERE B = 'something' AND C = 'something')
UNION ALL
(SELECT a FROM BB WHERE B = 'something' AND C = 'something')

Upvotes: 2

Related Questions