This topic is locked
[SOLVED]

  FULL OUTER JOIN

8/18/2012 3:46:16 PM
PHPRunner General questions
P
procheck author

Can someone explain the full outer join? When I try to create one in PHPRunner, I get a syntax error.
ie.
SELECT

table1.id,

table1.name

FROM table1

FULL OUTER JOIN table2 ON table1.id = table2.id
Thanks
Al

C
cgphp 8/18/2012

Are you using Mysql? It doesn't support FULL OUTER JOIN but you can simulate it.

P
procheck author 8/18/2012

Yes I am using MySQL. I thought that PHPRunner was simulating it. That explains my error. I've just been playing around with ways to do the following in PHPRunner. I have something like this working using Javascript, but it's slow and it started giving me an error in version 6.1 so I thought it would be a good time to revisit this. This union gives the different players between two users. I cannot use Distinct or Group By because it still includes the duplicates in the result. I was also looking at creating a MySQL view but I cannot use variables so the I started playing around with the Outer Join.
SELECT FROM players_chosen A WHERE pcPoolID = 'beerbox' AND UserName = 'beerking'

AND NOT EXISTS (SELECT b.playerid FROM players_chosen b WHERE pcPoolID = 'beerbox' AND

B.UserName = 'dandon' AND A.playerid = b.playerid)
UNION ALL
SELECT
FROM players_chosen A WHERE pcPoolID = 'beerbox' AND UserName = 'dandon'

AND NOT EXISTS (SELECT b.playerid FROM players_chosen b WHERE pcPoolID = 'beerbox' AND

B.UserName = 'beerking' AND A.playerid = b.playerid)
ORDER BY UserName

;
Thx
Al