SQL文求助
数据库:ACCESS或SQLSERVER
要求:
表table(a,b,c)
其中a有两个值A1,A2,b也有两个值B1,B2
求在四种组合A1B1,A1B2,A2B1,A2B2下c的值,已知四种组合中的值唯一
除了下面的方法外,还有其他的方法吗?
sql=select c as c1,"" as c2, "" as c3,"" as c4
from table where a=A1 and b=B1
union
select "" as c1,c as c2, "" as c3,"" as c4
from table where a=A1 and b=B2
union
select "" as c1,"" as c2,c as c3,"" as c4
from table where a=A2 and b=B1
union
select "" as c1,"" as c2, "" as c3,c as c4
from table where a=A2 and b=B2