• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Left join ON multiple columns?

Jaxel

Well-known member
#1
Is something like this possible?
Code:
SELECT EWRrio_streams.*,
    FROM EWRrio_streams
    LEFT JOIN EWRcanal_channels ON (
        EWRcanal_channels.service_id = EWRrio_streams.service_id AND
        EWRcanal_channels.channel_value1 = EWRrio_streams.channel_value1 AND
        EWRcanal_channels.channel_value2 = EWRrio_streams.channel_value2
        )
ORDER BY EWRrio_streams.stream_viewers DESC
 
#2
Is something like this possible?
Code:
SELECT EWRrio_streams.*,
    FROM EWRrio_streams
    LEFT JOIN EWRcanal_channels ON (
        EWRcanal_channels.service_id = EWRrio_streams.service_id AND
        EWRcanal_channels.channel_value1 = EWRrio_streams.channel_value1 AND
        EWRcanal_channels.channel_value2 = EWRrio_streams.channel_value2
        )
ORDER BY EWRrio_streams.stream_viewers DESC
SELECT * FROM table1
INNER JOIN table2 ON table2.id = table1.id
LEFT JOIN table3 ON table3.id = table2.id

i've written an example for you.
 

digitalpoint

Well-known member
#3
Is something like this possible?
Code:
SELECT EWRrio_streams.*,
    FROM EWRrio_streams
    LEFT JOIN EWRcanal_channels ON (
        EWRcanal_channels.service_id = EWRrio_streams.service_id AND
        EWRcanal_channels.channel_value1 = EWRrio_streams.channel_value1 AND
        EWRcanal_channels.channel_value2 = EWRrio_streams.channel_value2
        )
ORDER BY EWRrio_streams.stream_viewers DESC
Yep, you can (just like that).