求一句简单的sql语句
有三张表:
employee, 列名为employeeid name
jobyear, 列名为employeeid, jobid, jobyearid
jobyearmonth, 列名为jobid, jobyearid, month
我需要select出所有的jobyearmonth中的数据,而且前面加上name,请问应该怎么写?
------解决方案--------------------select c.name,a.*
from jobyearmonth a
left join jobyear b on a.jobyearid=b.jobyearid
left join employee c on b.employeeid=c.employeeid
------解决方案--------------------select name,jobid, jobyearid, month from employee a,jobyear b,jobyearmonth c where a.employeeid = b.employeeid and b.jobyearid = c.jobyearid and b.jobid = c.jobid
------解决方案--------------------employee, 列名为employeeid name
jobyear, 列名为employeeid, jobid, jobyearid
jobyearmonth, 列名为jobid, jobyearid, month
select a.name,c.* from employee a left join jobyear b on a.employeeid=b.emloyeeid
left join jobyearmonth c on b.jobid= c.jobid
------解决方案-------------------- select name,c.* from employee a,jobyear b,jobyearmonth c
where a.employeeid=b.employeeid and b.jobid=c.jobid and b.jobyearid=c.jobyearid