查询一个交叉表(从3个表到gridview) [英] query for a crosstable(from 3 tables into gridview)

查看:135
本文介绍了查询一个交叉表(从3个表到gridview)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库中有3个表:STUDENT,BOOK和GRADE.书表有结果栏,每个学生拿几本书.在成绩表中,有一列称为平均值(学生用书的平均成绩).

I have 3 tables in my db: STUDENT, BOOK and GRADE. Book table has the result column, Each student take few book. In Grade table there is a column named average (average of results for book of student). Is it possible to show in Datagridview a cross table where each row refer to a student and each column refer to a book result and one column for average?

推荐答案

您的意思是说:这样的东西?

You mean something like this?

SELECT TABLE1.COL, TABLE2.COL, TABLE3.COL
FROM TABLE1
JOIN TABLE2 ON TABLE1.ID = TABLE2.ID
JOIN TABLE3 ON TABLE1.ID = TABLE3.ID


这篇关于查询一个交叉表(从3个表到gridview)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆