I am trying to get a default query to implement upon page load but I get: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘FROM artist, cakes WHERE artist.artist_id = cakes.artist_id ORDER BY artist.ar’ at line 2
I’m quite new to SQL and my lecturer couldn’t help saying it is too complex but offered no further explanation so I thought it best to ask here.
The query in question:
$q = "SELECT artist.artist_id,
CONCAT_WS(' ', artist_name) AS artist,
cake_name,
price,
description,
cake_id,
FROM artist, cakes
WHERE artist.artist_id = cakes.artist_id
ORDER BY artist.artist_name ASC,
cakes.cake_name ASC"; //getting the cakes to display in ascending order of artist then cake name
Any help or insight where I’ve gone wrong would be gratefully received, thanks in advance!
You’ve got an extra comma after cake_id.