Term and sub term from custom post type query [closed]

The problem is, there might be 1, 2, 3, 4 or N levels of depth in the subcategories. So, writing the query is possible, but inefficient because to be this flexible, left joins will be required which are not fast.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)