zoukankan      html  css  js  c++  java
  • Sale表中横列值转换成竖列显示。

    SELECT EmployeeID,
        
    max(case SaleDate when '2007-01-01' then amount else null endas jan,
        
    max(case SaleDate when '2007-02-01' then amount else null endas feb,
        
    max(case SaleDate when '2007-03-01' then amount else null endas mar,
        
    max(case SaleDate when '2007-04-01' then amount else null endas apr,
        
    max(case SaleDate when '2007-05-01' then amount else null endas may,
        
    max(case SaleDate when '2007-06-01' then amount else null endas jun,
        
    max(case SaleDate when '2007-07-01' then amount else null endas aug
    from Liaohaibing.SALE
    group by Liaohaibing.SALE.EMPLOYEEID;

    EmployeID  jan  feb  mar  apr  may  jun  aug
     1 1005 1452 524 345 567 587 524
    2 1008 5224 524 345 567 578 552
    3 1007 5424 524 345 567 698 5224
    4 1005 5524 524 345 567 895 54
    5 1009 5224 524 345 567 698 554
    6 1008 524 524 345 567 2452 5221
    7 1006 524 524 345 567 354 4
    8 1005 524 524 345 567 243 5
    9 1005 524 524 345 567 2546 556
    10 100 524 524 345 567 5244 254

    有一个 Sale  表里面放着每个销售员每个月的销售情况

    现在要把这一年,按月分进行显示出每个销售员得销售情况。

    上面这种法子可以实现。

  • 相关阅读:
    ajax网站
    iTextSharp和jQuery和.Net教程
    搜索引擎学习资料
    tooltip 效果
    ccnet+web deploy远程发布
    创建报表时出现“缺少DataSetName属性的值”
    virtualBox 虚拟机相关设置
    数据库更新数据表时被禁止
    ACL
    windows server 添加IIS
  • 原文地址:https://www.cnblogs.com/xiaotuni/p/2365761.html
Copyright © 2011-2022 走看看