Inbox messages (2 types) from 2 tables

Discussion in 'MySQL' started by seo_newbie_, Mar 31, 2010.

  1. #1
    I would like to show all new messages and invitations (friend requests) in 1 page (Inbox) mixed together like this:
    Person Message title Date
    Nick Hi, how are you? 25.12.2010
    Linda Goint out tonight 25.12.2010
    Mark Mark invited you to his network 25.12.2010

    A structure of messages is the following:
    [​IMG]

    Invitations will be in another table and it will have only 4 fields:
    id | from | to | to_viewed | to_deleted | date | status

    Please could you advise me what would be the best choice for this, how to put those tables into 1 query. Join, UNION or something else?

    Thanks a lot
     
    seo_newbie_, Mar 31, 2010 IP