A
Anonymous
Guest
hi all here is the problem is that i have 2 table in both there is a column called user_name ok.
i would like to choose the user_name rows from the 1st table which is not exists in the second table.
here is an ex. for the contents of each table.
say table (usersonline) contains:
1-ahmed.
2-nadia.
3-sarah.
and table (forum_users_registered) contains:
1-ahmed.
2-nadia.
so i would like to choose (sarah from table usersonline)
my SQL code is:
and here is the result:
'user_name','User_Name'
'nadia','adly3000'
'sarah','adly3000'
'adly3000','nadia'
'sarah','nadia'
it displays a combination of the 2 tables which i don't need.cuz it compares the first row in table1 with each row in table2.but i'd like to compare 1st row in table1 with all rows in table2.then the 2nd row in table1 with all rows in table2. and so on.
i would like to choose the user_name rows from the 1st table which is not exists in the second table.
here is an ex. for the contents of each table.
say table (usersonline) contains:
1-ahmed.
2-nadia.
3-sarah.
and table (forum_users_registered) contains:
1-ahmed.
2-nadia.
so i would like to choose (sarah from table usersonline)
my SQL code is:
Code:
SELECT onl.user_name, r.User_Name
from usersonline onl, forum_users_registered r
where
AND onl.user_name != r.User_Name;
'user_name','User_Name'
'nadia','adly3000'
'sarah','adly3000'
'adly3000','nadia'
'sarah','nadia'
it displays a combination of the 2 tables which i don't need.cuz it compares the first row in table1 with each row in table2.but i'd like to compare 1st row in table1 with all rows in table2.then the 2nd row in table1 with all rows in table2. and so on.