Results 1 to 10 of 12

Thread: Unknown column 'p.products_id' in 'on clause'

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    jmarcv's Avatar
    jmarcv is offline Cranky Coder
    Join Date
    Jan 2005
    Posts
    354

    Default Mysql 5 JOIN syntax change

    Many older applications have been failing due to non standard queries which produce errors about columns not existing.

    In most instances, merely changing the order of tables is enough to fix a statement.

    Example:

    SELECT f.* from forums f ,categories c LEFT JOIN moderator m
    ON (f.id=m.forum_id) WHERE f.category=c.id
    The above produces an error about column f.id not existing, when we know it does.
    My merely switching the order of the table references:
    categories c and forums f
    we fix the problem.


    SELECT f.* from categories c,forums f LEFT JOIN moderator m
    ON (f.id=m.forum_id) WHERE f.category=c.id

    Please refer to the following link for more info.

    http://dev.mysql.com/doc/refman/5.0/en/join.html
    See particularly "Join Processing Changes in MySQL 5.0.12
    Last edited by jmarcv; 08-16-2006 at 11:50 AM. Reason: formatting

LinkBacks (?)


Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14