如何通过SQL语句根据查询出来的内容判断输出自己想要看到的内容

2025-01-21 04:20:16
推荐回答(2个)
回答1:

select a.ID,a.name,sex,b.ID,b.name,old from A full join B on a.ID=b,ID order by a.ID;
按下列方式试试。
select a.ID,a.name,sex,b.ID,b.name,old from A full join B on a.ID=b,ID
where (a.name is null and a.sex is null and b.name is not null) or
(a.name is not null and a.sex is not null and b.name is null)
order by a.ID;

回答2:

select switch([店类型]="0102","店1",[店类型]="0103","店2"……) as 店名称,* from 你的表
switch后面可以加多个