Jump to content


Photo

Mind Boggling (need help)


  • Please log in to reply
No replies to this topic

#1 skina

skina
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 26 April 2003 - 05:54 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users