Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004
    Posts
    6

    Unanswered: 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

  2. #2
    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.

  3. #3
    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

  4. #4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •