Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old March 17th, 2004, 06:41 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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

Reply With Quote
  #2  
Old March 17th, 2004, 06:43 PM
linkyguy linkyguy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Norfolk, UK
Posts: 5 linkyguy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Problem with a LEFT JOIN

i should remember to log in before posting on here, oh well its my request above

Reply With Quote
  #3  
Old March 17th, 2004, 08:09 PM
honcho's Avatar
honcho honcho is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Cape Cod
Posts: 1,347 honcho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 2 sec
Reputation Power: 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

Reply With Quote
  #4  
Old March 17th, 2004, 08:13 PM
-vertigo- -vertigo- is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Louth, Lincolnshire
Posts: 314 -vertigo- User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 24 sec
Reputation Power: 2
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;

Reply With Quote
  #5  
Old March 17th, 2004, 09:50 PM
linkyguy linkyguy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Norfolk, UK
Posts: 5 linkyguy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Problem with a LEFT JOIN

thank you both. worked great

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Problem with a LEFT JOIN


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT