Home > database >  Consult a relatively trouble queries
Consult a relatively trouble queries

Time:11-22

Known to have two tables:
Drop table if the exists aa
The create table aa (int a)
Insert into aa (a)
Union all select 1
Union all select 2
Select 3
Drop table if the exists aa
The create table bb (b1 varchar (10), b2 int)
Insert into bb (b1, b2)
Select the 'a', 1 union all
Select the 'a', 2 union all
Select the 'a', three union all
Select 'b', 1 union all
Union all select 'b', 2
Select the 'c', 1 union all
Select the 'c', 3

Want to achieve the following query results, among them, 1, 2, 3 is a form of aa all data, need changes along with the data in a form, can you tell me the how to query the
Select from bb where b1 b2=1
Intersects
Select from bb where b1 b2=2
Intersects
Select the from bb where b2 b1=3
  • Related