1. 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?

Discussion in 'General PHP and MySQL Discussions' started by Jaxel, Feb 24, 2014.

  1. Jaxel

    Jaxel Well-Known Member

    Is something like this possible?
    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. kingofseo

    kingofseo New Member

    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.
  3. digitalpoint

    digitalpoint Well-Known Member

    Yep, you can (just like that).
  4. rainmotorsports

    rainmotorsports Well-Known Member

    LOL This thread was from February.
    kingofseo likes this.

Share This Page