Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Sql :: sql order of operations 
Sql :: first max salary in sql 
Sql :: mysql pad zeros 
Sql :: insert multiple rows from another table sql 
Sql :: if sql 
Sql :: pl sql search saurce code 
Sql :: TRIGGER AFTER 
Sql :: sql select like 
Sql :: sql get actual fiscal year 
Sql :: inser into example 
Sql :: azure sql get all users 
Sql :: mysql get 2nd value in comma separated list 
Sql :: mysql join same table multiple times group by 
Sql :: psql attribute cannot login 
Sql :: mariadb search columns 
Sql :: how to show current database in mysql 
Sql :: mysql dependency for spring boot 
Sql :: mssql unique key accept nulls 
Sql :: To log postgres db in without a password 
Sql :: keys in sql with example 
Sql :: FIND ABOVE AVERAGE SALARY EARNER IN SQL 
Sql :: mysql workbench change default value 
Sql :: sql into 
Sql :: Triggers Syntax 
Sql :: sql: extract day text from datetime value 
Sql :: windows could not start the sql server on local computer 
Sql :: PG::ForeignKeyViolation: ERROR: update or delete on table violates foreign key constraint 
Sql :: Write an SQL query to determine the 5th highest salary without using TOP or limit method. 
Sql :: install sql server in ubuntu 20.04 
Sql :: right join 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =