#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    13
    Rep Power
    0

    Smile Display problems


    I am trying to do a query that displays the customer name with the "customer" label. Here's what I've done so far:

    SELECT a.account_id, a.cust_id, a.last_activity_date, a.open_emp_id,
    CONCAT(e.fname, ' ', e.lname) as Opened_by, a.avail_balance
    FROM account a INNER JOIN employee e
    ON a.open_emp_id = e. emp_id
    CONCAT (i.fname, i.lname, b.name) AS Customer
    FROM individual i INNER JOIN business b
    on b.cust_id = i.cust_id
    WHERE NOT EXISTS (SELECT 1
    FROM transaction t
    WHERE t.txn_date = a.last_activity_date);

    I got this error message:

    Error Code: 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 'CONCAT (i.fname, i.lname, b.name) AS Customer
    FROM individual i INNER JOIN busin' at line 5

    It had been working great until I added the 2nd CONCAT & INNER JOIN.

    Thanks in advance for helping someone who's still learning.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,777
    Rep Power
    348
    Originally Posted by bstar
    check the manual that corresponds to your MySQL server version
    Wrong forum. This one is for Postgres
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
    http://forums.devshed.com/misc.php?do=bbcode#code

    Tips on how to ask better questions:
    http://tkyte.blogspot.de/2005/06/how-to-ask-questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    13
    Rep Power
    0
    Originally Posted by shammat
    Wrong forum. This one is for Postgres
    Sorry. I guess I clicked on it my mistake.

IMN logo majestic logo threadwatch logo seochat tools logo