ok here's my wquestion about making amysql query that i cant resolve it seems to be very easy but i cant resolve it.. so thats why i ask for help here guys, hope you can help me!
I have two tables this is the structure:
TABLE1:
-uid
-name
-surname
TABLE2:
- uid
- site
- url
Well table explanation Table number 1 ahs the necesary info of an user. Table number 2 has the user id and his web pages (can be more than one), so the uid in table two can have duplicates...
well my problem is that im filling a select box with the name of the user but i need to fill it with the names that are not in the table two.. for example if i have already the user number 1 in the table two the select box only will have from 2 to n, it shouldnt shown user number 1.. this is the query im trying to use but it doesnt work
$sql = "SELECT TABLE1.uid
,TABLE1.name
FROM TABLE1,TABLE2
WHERE TABLE1.uid <> TABLE2.uid
";
so thats the query and donest work for me.. the only way it works is if i have only one user id in the table two but if i have more than one uid in table 2 the query retrieve alll the records
Question
Nxt_Gate
ok here's my wquestion about making amysql query that i cant resolve it seems to be very easy but i cant resolve it.. so thats why i ask for help here guys, hope you can help me!
I have two tables this is the structure:
TABLE1:
-uid
-name
-surname
TABLE2:
- uid
- site
- url
Well table explanation Table number 1 ahs the necesary info of an user. Table number 2 has the user id and his web pages (can be more than one), so the uid in table two can have duplicates...
well my problem is that im filling a select box with the name of the user but i need to fill it with the names that are not in the table two.. for example if i have already the user number 1 in the table two the select box only will have from 2 to n, it shouldnt shown user number 1.. this is the query im trying to use but it doesnt work
so thats the query and donest work for me.. the only way it works is if i have only one user id in the table two but if i have more than one uid in table 2 the query retrieve alll the records
Hope you can help guys!!
Thanks!
Link to comment
Share on other sites
2 answers to this question
Recommended Posts