已知有兩個表:
drop table if exists aa
create table aa(a int)
insert into aa(a)
select 1 union all
select 2 union all
select 3
drop table if exists aa
create table bb(b1 varchar(10),b2 int)
insert into bb(b1,b2)
select 'a',1 union all
select 'a',2 union all
select 'a',3 union all
select 'b',1 union all
select 'b',2 union all
select 'c',1 union all
select 'c',3
想達到下面的查詢效果,其中,1,2,3是表格aa中的所有資料,需要隨著表格中的資料變化而變化,請問該如何查詢
select b1 from bb where b2 = 1
InterSect
select b1 from bb where b2 = 2
InterSect
select b1 from bb where b2 = 3
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/32816.html
標籤:基礎類
上一篇:求幫助!!!
下一篇:請問這個陳述句要怎么改寫,謝謝
