SELECT * FROM Base.db WHERE ((<поле1> LIKE <значение>) AND (<поле2> IS NULL))
if Query.Field[0].AsBoolean=True then ...