需求举例:
我要先select * from song where name=’七里香‘
然后用查询结果和artist2song联合查询得到 id,name,artistId
然后再和artist联合查询把artist中的name加进去
这个sqlstring怎么写?
------解决方案--------------------
select
a.name,b. id,b.name,b.artistId
from
artist as a
inner join artist2song as b on a.id=b.artistId
inner join song as c on b.songId=c.id
where
c.name=’七里香‘
------解决方案--------------------
select *
from song a
inner join artist2song b
on a.id=b.songId
inner join artist c
on b.artistId=c.id
where a.name='七里香'
????