Results 1 to 3 of 3

Thread: SQL Error : Ambiguous column name 'last_name'.

  1. #1
    jasonj is offline Sugar Community Member
    Join Date
    Sep 2006
    Location
    Brisbane
    Posts
    45

    Thumbs down SQL Error : Ambiguous column name 'last_name'.

    Oh the pain .. the pain .... EMAIL GROUP INBOX module.. sort by Contact and then try and move through the record set... BANG you get SQL Error : Ambiguous column name 'last_name'. Is there a dummies guide to how SUGAR generates its SQL query strings.. I think know what is wrong .. I just don't know where to "tinker" with the syntax.

  2. #2
    hkphooey is offline Sugar Community Member
    Join Date
    Jan 2007
    Posts
    94

    Default Re: SQL Error : Ambiguous column name 'last_name'.

    I've encountered this writing queries for MySQL by hand. Seems to be something to do with backquotes. eg
    Code:
    SELECT * FROM table1 LEFT JOIN table2 on table1.last_name=table2.last_name
    will work, whereas
    Code:
    SELECT * FROM table1 LEFT JOIN table2 on `table1.last_name`=`table2.last_name`
    will not, giving the error you state. Can't figure out why this would be so. Running MySQL 5.x

  3. #3
    egork is offline Sugar Community Member
    Join Date
    Nov 2006
    Location
    Duesseldorf, Germany
    Posts
    50

    Default Re: SQL Error : Ambiguous column name 'last_name'.

    Quote Originally Posted by hkphooey
    I've encountered this writing queries for MySQL by hand. Seems to be something to do with backquotes. eg
    Code:
    SELECT * FROM table1 LEFT JOIN table2 on table1.last_name=table2.last_name
    will work, whereas
    Code:
    SELECT * FROM table1 LEFT JOIN table2 on `table1.last_name`=`table2.last_name`
    will not, giving the error you state. Can't figure out why this would be so. Running MySQL 5.x
    Hi, just a wild guess, may be putting something in quotes makes it to be one token, so it won't get parsed into table name and column name, giving you an error? (object not found, right?)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 2008-02-22, 04:25 PM
  2. MS SQL Error
    By starace in forum General Discussion
    Replies: 7
    Last Post: 2007-06-27, 07:20 PM
  3. Replies: 1
    Last Post: 2006-09-11, 03:38 PM
  4. SugarCrm 4.0 Patch
    By mgamboa in forum General Discussion
    Replies: 0
    Last Post: 2005-12-21, 04:14 PM

Bookmarks

Posting Permissions

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