数据查询的问题(100分)

  • 主题发起人 主题发起人 cb1997
  • 开始时间 开始时间
C

cb1997

Unregistered / Unconfirmed
GUEST, unregistred user!
现在有个如下的表<br>日期 &nbsp; &nbsp;地区 &nbsp; &nbsp;品种 &nbsp;销量<br>2001 &nbsp; &nbsp;四川 &nbsp; &nbsp;a &nbsp; &nbsp; 1111<br>2001 &nbsp; &nbsp;重庆 &nbsp; &nbsp;a &nbsp; &nbsp; 2111<br>2001 &nbsp; &nbsp;云南 &nbsp; &nbsp;a &nbsp; &nbsp; 3111<br>2002 &nbsp; &nbsp;四川 &nbsp; &nbsp;a &nbsp; &nbsp; 1222<br>2002 &nbsp; &nbsp;重庆 &nbsp; &nbsp;a &nbsp; &nbsp; 2222<br>2002 &nbsp; &nbsp;云南 &nbsp; &nbsp;a &nbsp; &nbsp; 3222<br>2003 &nbsp; &nbsp;四川 &nbsp; &nbsp;a &nbsp; &nbsp; 1333<br>2003 &nbsp; &nbsp;重庆 &nbsp; &nbsp;a &nbsp; &nbsp; 2333<br>2003 &nbsp; &nbsp;云南 &nbsp; &nbsp;a &nbsp; &nbsp; 3333<br><br>我想用个查询显示成如下<br>地区 &nbsp; 品种 &nbsp;2001年销量 &nbsp; &nbsp; 2002年销量 &nbsp; &nbsp;2003年销量<br>四川 &nbsp; a &nbsp; &nbsp; &nbsp;1111 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1222 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1333<br>重庆 &nbsp; a &nbsp; &nbsp; &nbsp;2111 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2222 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2333<br>云南 &nbsp; a &nbsp; &nbsp; &nbsp;3111 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3222 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3333<br><br>如果能在dbgrid下显示成这种也可以!
 
手工编程写吧
 
手工编写,要电脑就没用了嘛:)
 
这是行列转换问题 你用什么数据库啊?
 
access数据库!<br>楼上的给点提示嘛
 
TRANSFORM Sum(销量)<br>SELECT 地区, 品种<br>FROM 表<br>GROUP BY 地区,品种<br>PIVOT 日期
 
dcx0026:<br>TRANSFORM Sum(销量) 是什么意思呀?
 
如楼上,select里面排好位置
 
TRANSFORM Sum(销量)<br>这个是求和了的吗,我现在不要求和,只要明细数据,如何做呢
 
后退
顶部