如何在mysql中转移我的表

时间:2016-12-25 10:29:43

标签: mysql

我有这样的表数据库:

enter image description here

我想在桌面视图上做这样的:

enter image description here

感谢。

2 个答案:

答案 0 :(得分:0)

尝试这个逻辑,希望它有所帮助。

// Delete confirmation
if (MessageBox.Show ("The operation cannot be undone! Continue?", "Delete",
        MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        == DialogResult.Yes) 
{
    //Delete the row
}

答案 1 :(得分:0)

我认为你每年都需要它。

Select year, id_lesson,
Sum(case when term = 1 then exam_1 end) exam_1_term_1,
Sum(case when term = 1 then exam_2 end) exam_2_term_1,
Sum(case when term = 2 then exam_1 end) exam_1_term_2,
Sum(case when term = 2 then exam_2 end) exam_2_term_2,
Sum(case when term = 3 then exam_1 end) exam_1_term_3,
Sum(case when term = 3 then exam_2 end) exam_2_term_3
From your_table
Group by id_lesson, year;