Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

UNION ALL LEFT JOIN

SELECT
    comments.*, users.company, users.contact_person, users.email
    FROM
        comments
    LEFT JOIN users ON users.user_id = comments.user_id
    WHERE
        comment_id = %s
UNION ALL
SELECT activity.*, users.company, users.contact_person, users.email
    FROM
        activity
    LEFT JOIN users ON users.user_id = activity.user_id
    WHERE
        comment_id = %s
ORDER BY
    timestamp ASC
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #UNION #ALL #LEFT #JOIN
ADD COMMENT
Topic
Name
3+3 =