mysql> select * from challenge; +----+--------+-------------+--------+------+---------+--------------+ | ID | PLR_ID | ACC_TYPE_ID | season | year | CHAR_ID | +----+--------+-------------+--------+------+---------+--------------+ | 1 | 1 | 1 | Fall | 2015 | 1175 | | 2 | 1 | 4 | Fall | 2015 | 1175 | | 3 | 1 | 3 | Fall | 2015 | 1175 | | 4 | 1 | 10 | Fall | 2015 | 1175 | | 5 | 1 | 13 | Fall | 2015 | 1175 | | 6 | 1 | 2 | Fall | 2015 | 1175 | +----+----------+----------------------+--------+-------+-------------+ 6 rows in set (0.00 sec)
mysql> select * from patrocinio; +----+------------+---------------+-------------+ | ID | PTRN_ID | CHLNG_ID | AMOUNT | +----+------------+---------------+-------------+ | 1 | 1 | 1 | 1.00 | | 2 | 4 | 3 | 2.00 | | 3 | 3 | 6 | 1.00 | +----+-----------+-----------------+------------+ I would like to select all rows from challenges which are NOT linked to a patrocinio with the PTRN_ID -- which would be rows 2 through 6 of challenges.
I am trying to go about this with a LEFT JOIN query but it does not seem to be working for me.
mysql> select c.ID FROM challenge c LEFT JOIN patrocinio p ON c.ID=p.CHLNG_ID WHERE p.PTRN_ID!=1; Empty set (0.00 sec)
Instead of getting rows 2 through 6 of challenges I get no rows.
Any help on how to correctly do this query would be greatly appreciated.
Thanks
Sep 04
Peter Brawley Re: Trouble with LEFT JOIN
Sep 04, 2015; 11:18
Peter Brawley
Re: Trouble with LEFT JOIN
Sep 04
Richard Reina Re: Trouble with LEFT JOIN
Sep 04, 2015; 12:24
Richard Reina
Re: Trouble with LEFT JOIN
Sep 04
Peter Brawley Re: Trouble with LEFT JOIN
Sep 04, 2015; 12:30
Peter Brawley
Re: Trouble with LEFT JOIN
Sep 25
Richard Reina Re: Trouble with LEFT JOIN
Sep 25, 2015; 10:08
Richard Reina
Re: Trouble with LEFT JOIN
Sep 26
Adrian Beech RE: Trouble with LEFT JOIN
Sep 26, 2015; 12:16
Adrian Beech
RE: Trouble with LEFT JOIN
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!