|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem with a LEFT JOIN
Hi,
I've been baffled with a mysql query. I have spent hours on it now and just get the error: #1064 - 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 store_shoppertrack LEFT JOIN catalog ON store_shoppertrac If anyone has any ideas, let me know. sql query below: SELECT store_shoppertrack.id, catalog.title, catalog.price, store_shoppertrack.sel_item_qty, FROM store_shoppertrack LEFT JOIN catalog ON store_shoppertrack.sel_item_id = catalog.id WHERE session_id = 24ed35c597b9e234de0280e600d85902 LIMIT 0 , 30 Thanks |
|
#2
|
|||
|
|||
|
RE: Problem with a LEFT JOIN
i should remember to log in before posting on here, oh well its my request above
|
|
#3
|
||||
|
||||
|
RE: Problem with a LEFT JOIN
Remove the comma after store_shoppertrack.sel_item_qty and put quotes around the session id.
Code:
SELECT store_shoppertrack.id, catalog.title, catalog.price, store_shoppertrack.sel_item_qty FROM store_shoppertrack LEFT JOIN catalog ON store_shoppertrack.sel_item_id = catalog.id WHERE session_id = '24ed35c597b9e234de0280e600d85902' LIMIT 0 , 30 |
|
#4
|
|||
|
|||
|
RE: Problem with a LEFT JOIN
And use table aliases to make the query easier to read, that usually helps alot.
SELECT st.id, c.title, c.price, st.sel_item_qty FROM store_shoppertrack st LEFT JOIN catalog c ON st.sel_item_id = c.id WHERE session_id = '24ed35c597b9e234de0280e600d85902' LIMIT 0, 30; |
|
#5
|
|||
|
|||
|
RE: Problem with a LEFT JOIN
thank you both. worked great
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Problem with a LEFT JOIN |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|