发布时间:2012-12-13 15:12:12
工作中应该开发的要求,需要对1月到12月的数据用列的方式表示出来。表:CREATE TABLE orders(cid INT,cname VARCHAR(50),createdate DATETIME) SQL语句实现: SELECTb.cname,b.cid,MAX(b.MaxTimeZuoGui) MaxTimeZuoGui,MIN(b.MinTimeZuoGui) MinTimeZuoGui,SUM(b.month1) month1,SUM(b.month2) month2,SUM(b.month3) month3,SUM(b.month4) month4,SUM(b.month5)......【阅读全文】