콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3010 화면

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 

아바타
취소
베스트 답변

Hi Hendy,

I have just changed the referencing name of models for easy understanding

select aml.analytic_account_id as x_analytic_account_id, SUM(aml.debit - aml.credit) as x_expense
from account_move_line as aml
left join account_account as aa on aml.account_id = aa.id
left join account_account_type as aat on aa.user_type_id = aat.id
where aat.name = 'Expenses' and aml.parent_state ='posted'
group by
aml.analytic_account_id

parent_state field is in account_move_line  and  not  in  account_account_type,  you  were  calling  it  wrongly,

Hope  it  helps,

Thanks


아바타
취소
작성자

Thanks !

관련 게시물 답글 화면 활동
1
2월 25
1471
0
10월 24
1639
1
2월 23
2702
1
11월 22
5937
1
10월 21
3445