请问 SQL 高手

来源: 2009-06-16 16:36:44 [旧帖] [给我悄悄话] 本文已被阅读:
下面这样的情况是不是可以用一句query 出来?

从一个表 :
orderid,storeid,itemid,quantity,date

导出另外一个表:
colum1: 下面是itemname1,itemname2,itemname3......

colum2: TH->storeid1 ,然后下面是 quantity1(对应itemname1),quantity2(对应itemname2),quantiy3(对应itemname3).......

colum3: TH->storeid2, 然后下面是 quantity1(对应itemname1),quantity2(对应itemname2),quantity3(对应itemname3)........
.
.
.
columend:TH->total, 然后下面是 total1(for quantity1),total2(for quantity2),...

请问这个怎样实现 ?thanks!