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

    Join Date
    Nov 2011
    Posts
    7
    Rep Power
    0

    Left join problem


    I need to retrieve data from 3 tables, so the sql query I use is:

    SELECT * FROM 98_person p
    LEFT JOIN 98_status s ON s.stat_memcode = p.memcode
    LEFT JOIN 98_deliver d ON d.del_memcode = p.memcode;
    Always there is one record in 98_status table related to each record of 98_person table, but in the 98_deliver table may have no record or
    more than one record, and I want to show just last record in 98_deliver table.

    Could anybody help me with that?
  2. #2
  3. Lord of the Dance
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Oct 2003
    Posts
    4,206
    Rep Power
    2012
    Maybe this explanation will help you: https://thoughtbot.com/blog/ordering...roup-by-clause

IMN logo majestic logo threadwatch logo seochat tools logo