mysql - Select exclude if one row matches -


i'm looking fast way search in table excluding results in join.

two simpelfied tabels:

table 1 - article_id - term_id  table 2 - article_id - loc_id 

in table 1 there can multiple rows same article_id, can linked multiple terms. i'm looking select query results table 2, loc_id 1 dont have row in table 1 term_id 20.

the 2 tables joind on there article_ids ofc.

if use normale join, , set on term_id != 20, still results if article linked term_id 19.

try below

select * table1 t1  join  table2 t2 on t1.article_id=t2.article_id t2.loc_id = 1 , t1.term_id <> 20 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -