Excluding

G

gmore

Hello,

I've got a table containing suppliers (two fields: supplier_code and
supplier_name) and another one containing suppliers' codes to exclude from
showing up. Since I've got more than 45 suppliers to exclude, I've given up
with the idea of putting everything in the criteria with the "not like"
expression.

Is someone know how to perform this condition in my query? If yes, any
suggestions?

Thanks,
gmore
 
J

Jason Lepack

/* Powered by General SQL Parser (www.sqlparser.com) */

SELECT S.supplier_code,
S.supplier_name
FROM tbl_suppliers AS S
LEFT JOIN tbl_exclude AS E
ON S.supplier_code = E.supplier_code
WHERE E.supplier_code IS NULL

tbl_suppliers - the table that you want to select the data from
tbl_exclude - the table with the supplied codes you want to exclude

This will select all records from tbl_suppliers where there is no
match in tbl_exclude.

Cheers,
Jason Lepack
 
G

gmore

Thanks

Jason Lepack said:
/* Powered by General SQL Parser (www.sqlparser.com) */

SELECT S.supplier_code,
S.supplier_name
FROM tbl_suppliers AS S
LEFT JOIN tbl_exclude AS E
ON S.supplier_code = E.supplier_code
WHERE E.supplier_code IS NULL

tbl_suppliers - the table that you want to select the data from
tbl_exclude - the table with the supplied codes you want to exclude

This will select all records from tbl_suppliers where there is no
match in tbl_exclude.

Cheers,
Jason Lepack
 
Top