access select 查询语句

2025-02-27 09:06:23
推荐回答(1个)
回答1:

不写sql,根本就运行不出来

以下三个字段都是短文本类型,你要是设置其他类型直接运行可能报错

sql语句:

select t1.列1,t1.列2,switch(t1.列1=t2.列1 and t1.列2=t2.列2,t2.列3,true,'-') as 列3 from
(select a.列1,b.列2 
from
(select a.列1,b.列2 from
(select distinct 列1 from test) as a,
(select distinct 列2 from test) as b)) t1 left join test as t2 on t1.列1=t2.列1 and t1.列2=t2.列2
order by t1.列1,t1.列2

结果:

设计视图你可以参考一下,不过没什么用,不写sql语句是构造不出来的