Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    7

    Unanswered: Join based on max value in a column?

    I have two tables:

    [page]
    page_id
    name

    [page_edits]
    page_id
    edited_datetime
    edited_text


    Many [page_edit] records to each [page] record, they store each change someone makes to each [page] record. I want to join these two tables, getting all [page] records together with *only the most recent* [page_edits] records they are related to. So for instance:

    [page]
    1, 'first page'
    2, 'second page'
    3, 'third page'

    [page_edits]
    1, 1900-02-01, 'initial create of page 1' // Record should *NOT* show up in the JOIN
    2, 1900-02-01, 'inital create of page 2'
    3, 1900-02-01, 'inital create of page 3'
    4, 1950-12-31', 'edit of page 1' // This record *SHOULD* show up


    After the join I want:
    1, 'first page', 4, 1950-12-31, 'edit of page 1'
    2, 'second page', 2, 1900-02-01, 'inital create of page 2'
    3, 'third page', 3, 1900-02-01', 'inital create of page 3'

  2. #2
    Join Date
    Sep 2005
    Posts
    7
    No one...?

Posting Permissions

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