I not imagine how to build query. I need to select rows from table CONTENT
which hasn't column tmplvarid=8 in left joined TEMPLATE VARIABLES
column
SELECT con.id, con.alias, tv.tmplvarid FROM modx_site_content as con LEFT JOIN modx_site_tmplvar_contentvalues as tv ON con.id=tv.contentid WHERE con.deleted=0 AND (con.content IS NULL OR con.content='') AND con.template=5 AND tv.tmplvarid!=8/*not contains 8*/
Explanation: https://i.stack.imgur.com/gdgha.png