MySQL Left Join - Appending to variable
Posted on 2011-10-06
I'm joining two tables.
Let's say table one is...
Table Name: items
Table Name: prices
Item Price URLID
My SQL goes like...
FROM items t1
LEFT JOIN prices t2 ON t2.URLID = 'item'.t1.ID
WHERE t1.ID = '5'
What would the proper syntax be to do that?
As you can see - ID's variable in the first table (in this instance 5) relates to the 'item/VARIABLE' in the second table (in this instance, item/5).
The " t2.URLID = 'item'.t1.ID" is apparently wrong syntax - as it doesn't work.
How would I properly phrase that?