Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INNER JOIN BASED ON NON-EQUALITY - VERY INTERESTING PROBLEM 1

Status
Not open for further replies.

globalefekt

Programmer
Jan 29, 2006
2
TR
I have a php script browsing a field from table 1, after user selects one the scripts adds selected field to another table. Now I dont want to browse already added fields. I have a query like this:

select table1.f1, table1.f2 from table1, table2 where (table1.f1=32 and table1.f3<>table2.f4)

Why this doesnt work??? it returns all fields (multiplying number of all records)!

I want fields from table 1 which does not exist in table 2...

What am I doing wrong....It looks so simple but I cant see the problem...

thanks folks...
 
Code:
select table1.f1
     , table1.f2 
  from table1
[b]left outer
  join[/b] table2 
    on table1.f3 = table2.f4
 where table1.f1 = 32      
   [b]and table2.f4 is null[/b]


r937.com | rudy.ca
 
r937, I don't know whether you are an android or not but your reply saved my life, thank you man... In both forums ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top