--delete from tmp_miss_search;

--COPY tmp_miss_search FROM '/WorkSpace/TMP/result.csv' DELIMITER ',' CSV;
/*
create table tmp_miss_search(
str text,
num integer)
*/


select * from tmp_miss_search

where not exists (select * from live.mat_langs M  where M.cms_locality_id = 16 AND lang_cd = 'en_US'  AND
			(lower( mat_nm || search_keywords) like '%' || trim( trailing 'es' from str) || '%'
			 or lower(mat_nm || search_keywords) like '%' || trim( trailing 'ies' from str) || '%'))

order by num desc;


