I have two tables, songs and history. The songs table looks like:
ID | title | artist | duration
1 | some title | some artist | 83592
The history table looks like:
ID | title | artist | duration | date_played
5 | some title | some artist | 83592 | 2012-08-08 11:22:00
How would I echo the ID from the songs table if the title and the artist from the most recent entry in the history table matches?
I tried SELECT * FROM history JOIN songs ON title=songs.title AND artist=songs.artist ORDER BY date_played DESC LIMIT 0, 1 but that didn't work. Any ideas?