AND addresses.id_address NOT IN (
SELECT id_address FROM clients_addresses WHERE id_address = addresses.id_address
)
AND clients_addresses.id_address IS NULL
SELECT
a.*,
accounts.id_account,
accounts.name as name_account,
clients_addresses.id_client as on_client,
clients.name
FROM
(SELECT
*
FROM addresses
WHERE id_project = 10
AND id_account = 65
) a
LEFT JOIN ....
public function getCategoryNames($product_id) {
$query = $this->db->query("SELECT *, dac.top
FROM " . DB_PREFIX . "category_description cd
LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p2c.category_id = cd.category_id)
LEFT JOIN " . DB_PREFIX . "de_av_category as dac ON (p2c.category_id = dac.category_id)
WHERE p2c.product_id = '" . (int)$product_id . "'AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
return $query->rows;
}