|
本帖最后由 todaynew 于 2009-3-24 16:01 编辑
俺也需要
ynjxw 发表于 2009-3-24 15:09
查询:
SELECT 商店号, iif(产品1=yes,"产品1","") AS 产品 FROM 表1
UNION ALL SELECT 商店号, iif(产品2=yes,"产品2","") AS 产品 FROM 表1
UNION ALL SELECT 商店号, iif(产品3=yes,"产品3","") AS 产品 FROM 表1
UNION ALL SELECT 商店号, iif(产品4=yes,"产品4","") AS 产品 FROM 表1
UNION ALL SELECT 商店号, iif(产品4=yes,"产品4","") AS 产品 FROM 表1;
转置查询:
SELECT 查询.商店号, 查询.产品
FROM 查询
WHERE (((查询.产品)<>""))
ORDER BY 查询.商店号;
或
select * from
(SELECT 商店号, iif(产品1=yes,"产品1","") AS 产品 FROM 表1
UNION ALL SELECT 商店号, iif(产品2=yes,"产品2","") AS 产品 FROM 表1
UNION ALL SELECT 商店号, iif(产品3=yes,"产品3","") AS 产品 FROM 表1
UNION ALL SELECT 商店号, iif(产品4=yes,"产品4","") AS 产品 FROM 表1
UNION ALL SELECT 商店号, iif(产品4=yes,"产品4","") AS 产品 FROM 表1) as a
where a.产品<>""; |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|