Hi, im having a problem with some SQL code, it looks really simple and i really can\'t understand why it\'s not giving the desired output, any help would be greatly appreciated:
This is the SQL statement i\'m trying to run:
SELECT t2.* FROM t1, t2 WHERE t1.rid <> t2.rid;
table1:
ID rid
31 1
32 2
table2:
ID rid
9 1
10 2
11 3
12 4
13 5
I was expecting the output to be:
11 3
12 4
13 5
But instead got:
ID rid
10 2
10 2
11 3
11 3
11 3
12 4
12 4
12 4
9 1
9 1
13 5
13 5
13 5
This seemed pretty crazy to me, all i wanted was for the query to retrieve only the records which didnt have matching rid\'s. This was all done on phpmyadmin as after having problems with the code i thought it would be easier to debug it using phpmyadmin. If anyone can tell me why its showing all the results multiple times and also a way i can recieve the data i want it to will be greatly appreciated.