select a.fDate,b.number,c.courseName,b.beginTime,b.endTime,d.credits,e.homeworkId from u_studyTime AS a inner join c_restTime as b ON (a.ID=b.ID) inner join d_Course as c ON (c.ID=b.ID) inner join u_Credits as d ON (d.courseId=b.courseId) inner join u_noHomeWork as e ON (c.courseName=e.ID)
求怎么查询 求代码 求解析!小弟跪谢!
如果这些表没有关联的列(即没有共同的条件) 而你又想把这些表的数据都显示出来 可以这样写
select a.*,b.*,c.*,d.* ,e.* from u_studyTime AS a,c_restTime as b,d_Course as c,u_Credits as d,u_noHomeWork as e
这样就会把这些表的数据都显示出来
怨我没说清楚 我是要跟不用的表取出不同的列!
@水嫩小白菜:
一样的 a.*表示所有列 想显示个别列 就写出列名 如下
select a.fDate,b.number,c.courseName,b.beginTime,b.endTime,d.credits,e.homeworkId from u_studyTime AS a ,c_restTime as b,d_Course as c ,u_Credits as d , u_noHomeWork as e
这样查询是能查询得出来,但就是重复的数据会太多