Query :
SELECT a.analytic_account_id AS x_analytic_account_id, SUM(a.debit - a.credit) AS x_expense FROM account_move_line AS a LEFT JOIN account_account AS b ON a.account_id=b.id LEFT JOIN account_account_type AS c ON b.user_type_id=c.id WHERE c.name = 'Expenses' AND c.parent_state ='Posted' GROUP BY a.analytic_account_id
Example Error
The SQL query is not valid:
 column c.parent_state does not exist
LINE 11:     c.name = 'Expenses' AND c.parent_state ='Posted'
                                     ^
HINT:  Perhaps you meant to reference the column "a.parent_state".
So ,  I  want  to  show  query with  status  = Posted 
