表结构和数据
year month amount
1991 1 1.1
1991 2 1.2
1991 3 1.3
1991 4 1.4
1992 1 4.6
1992 2 1.5
1992 3 2.4
1992 4 2.2
查询结果
year m1 m2 m3 m4
1991 1.1 1.2 1.3 1.4
1992 4.6 1.5 2.4 2.2
依据结果写SQL语句。


答案 :

select a.[year],a.amount as m1,b.amount as m2,c.amount as m3,d.amount as m4

from table1 as a,table1 as b,table1 as c,table1 as d where

a.[month]=b.[month] and b.[month]=c.[month] and c.[month]=d.[month]

and a.[year]=b.[year] and b.[year]=c.[year] and c.[year]=d.[year]
order by a.[year]

优质内容筛选与推荐>>
1、神奇语言 python 函数的进阶
2、检查数据库名称与数据库逻辑名、物理文件名称是否一致,并生成修复脚本
3、JSP和LE表达式
4、js获取URL中的参数值
5、Linux文件系统


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号