我有两张桌子,歌曲和历史。歌曲表如下所示:
ID | title | artist | duration
1 | some title | some artist | 83592
历史表如下所示:
ID | title | artist | duration | date_played
5 | some title | some artist | 83592 | 2012-08-08 11:22:00
如果历史表中最新条目中的标题和艺术家匹配,我将如何从歌曲表中回显 ID?
我试过SELECT * FROM history JOIN songs ON title=songs.title AND artist=songs.artist ORDER BY date_played DESC LIMIT 0, 1
了,但没有用。有任何想法吗?