If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Syntax Error in SQL query can figure out what it is. please help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-13-05, 15:20
hawkseye hawkseye is offline
Registered User
 
Join Date: Dec 2004
Posts: 6
Syntax Error in SQL query can figure out what it is. please help

i have a query when i run it it sys "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 'SELECT customerID, count(adID) AS noOfAds FROM a"


my query is
SELECT c.customerID, c.firstName, c.Email, c.membershipType, a.noOfAds FROM customerInfo c, (SELECT customerID, count(adID) AS noOfAds FROM adInfo Group BY customerID) a WHERE c.customerID = a.customerID ORDER BY firstName ASC



Please identify me whats wrong
Reply With Quote
  #2 (permalink)  
Old 12-13-05, 15:54
hawkseye hawkseye is offline
Registered User
 
Join Date: Dec 2004
Posts: 6
What im trying to do is get customer info which is in table customerInfo and count the number of ads against that customer from adInfo table.
Reply With Quote
  #3 (permalink)  
Old 12-13-05, 18:00
Zinguy Zinguy is offline
Registered User
 
Join Date: Dec 2005
Posts: 3
SELECT c.customerID, c.firstName, c.Email, c.membershipType, (SELECT count(adID) AS noOfAds FROM adInfo a WHERE c.customerID = a.customerID )
FROM customerInfo c
ORDER BY c.firstName ASC
Reply With Quote
  #4 (permalink)  
Old 12-14-05, 11:14
hawkseye hawkseye is offline
Registered User
 
Join Date: Dec 2004
Posts: 6
i think the problem is with the version. im using mysql 4.013. Isnt there any other way i can do this. i can not use two different queries because im also sorting data at the fronend.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On