Home > Database > Mysql Tutorial > body text

Excel2007根据SQL语句生成透视图的一些关键点

WBOY
Release: 2016-06-07 17:46:44
Original
1469 people have browsed it

环境:Win2003+sp1、 Office 2007、 SQL 2005  Express

如统计每个人的总分,

SQL中有三个表:t_stu(学生信息表)、t_sub(课程)、t_score(分数表)

 需要根据下面的SQL语句,生成一个图

要点一、在表格中插入图后,在EXCEL表格中会生成一个数据图的样式。
点击该图,然后,点击菜单“数据/属性”,在弹出的“连接属性”窗口中,选择“定义”标签。命令类型中选择“SQL”。(默认是表)如下图:


在下面的“命令文本”框中输入SQL语句:
SELECT t_stu.stu_name,sum(t_score.score) as 总分
  FROM t_stu,t_sub,t_score
where t_stu.stu_id=t_score.stu_id
and t_score.sub_id=t_sub.sub_id
group by t_stu.stu_name
然后点击“确定”。提示是否修改,点击“是”。

要点二“在“图字段列表”中,可以选择要显示的字段,并调整是在横坐标和纵坐标显示。

如下图:(注意:下表中的横坐标的字段可以拖动进行排列

显示效果图:

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!