基本完成,已经发邮件了~~~
外部数据源创建数据透视表+新建数据库查询+Microsoft Query+SQL语句- SELECT 2007 as [年份],'旗舰1店' as [4S店名],`车型`,left(`发动机号码-维修代码`,11) as [发动机号码],right(`发动机号码-维修代码`,6) as [维修代码],`1季度销量`,`2季度销量`,`3季度销量`, `4季度销量` FROM `D:\竞赛基础题\2007年`.`旗舰1店$` `旗舰1店$` union all
- SELECT 2007 as [年份],'旗舰2店' as [4S店名],`车型`,left(`发动机号码-维修代码`,11) as [发动机号码],right(`发动机号码-维修代码`,6) as [维修代码],0 as `1季度销量`,0 as `2季度销量`,0 as `3季度销量`,0 as `4季度销量` FROM `D:\竞赛基础题\2007年`.`旗舰2店$` `旗舰2店$` union all
- SELECT 2008 as [年份],'旗舰3店' as [4S店名],`车型`,left(`发动机号码-维修代码`,11) as [发动机号码],right(`发动机号码-维修代码`,6) as [维修代码],`1季度销量`,`2季度销量`,`3季度销量`,0 as `4季度销量` FROM `D:\竞赛基础题\2008年`.`旗舰3店$` `旗舰3店$` union all
- SELECT 2008 as [年份],'旗舰4店' as [4S店名],`车型`,left(`发动机号码-维修代码`,11) as [发动机号码],right(`发动机号码-维修代码`,6) as [维修代码],0 as `1季度销量`,`2季度销量`,0 as `3季度销量`, `4季度销量` FROM `D:\竞赛基础题\2008年`.`旗舰4店$` `旗舰4店$`
复制代码 SQL语句错误造成整个结果不正确,不得分。正确代码如下:- SELECT 2007 as [年份],'旗舰1店' as [4S店名],`车型`,left(`发动机号码-维修代码`,11) as [发动机号码],right(`发动机号码-维修代码`,6) as [维修代码],`1季度销量`,`2季度销量`,`3季度销量`, `4季度销量` FROM `D:\竞赛基础题\2007年`.`旗舰1店$` `旗舰1店$` union all
- SELECT 2007 as [年份],'旗舰2店' as [4S店名],`车型`,left(`发动机号码-维修代码`,11) as [发动机号码],right(`发动机号码-维修代码`,6) as [维修代码],0 as `1季度销量`,0 as `2季度销量`,0 as `3季度销量`,`4季度销量` FROM `D:\竞赛基础题\2007年`.`旗舰2店$` `旗舰2店$` union all
- SELECT 2008 as [年份],'旗舰3店' as [4S店名],`车型`,left(`发动机号码-维修代码`,11) as [发动机号码],right(`发动机号码-维修代码`,6) as [维修代码],`1季度销量`,`2季度销量`,`3季度销量`,0 as `4季度销量` FROM `D:\竞赛基础题\2008年`.`旗舰3店$` `旗舰3店$` union all
- SELECT 2008 as [年份],'旗舰4店' as [4S店名],`车型`,left(`发动机号码-维修代码`,11) as [发动机号码],right(`发动机号码-维修代码`,6) as [维修代码],0 as `1季度销量`,`2季度销量`,0 as `3季度销量`, `4季度销量` FROM `D:\竞赛基础题\2008年`.`旗舰4店$` `旗舰4店$`
复制代码
[ 本帖最后由 BIN_YANG168 于 2009-3-23 15:15 编辑 ] |