Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4060 มุมมอง

Hello community,

i am using below query and it shows me two rows due to project_type is selection(Internal, Project) field.

My requirement is sum(unit.amount) show be visible in two column for project_type instead of two rows. 

SELECT project_id, project_type, SUM(unit_amount)  FROM account_analytic_line where project_id = 2 GROUP BY project_type, project_id

Current Result:

469;"Internal";154.416666666667

469;"Project";3963.08333333333

Required result:

469; 154.416666666667; 3963.08333333333




Thanks in advance.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Try refer the following link.

https://stackoverflow.com/questions/43870/how-to-concatenate-strings-of-a-string-field-in-a-postgresql-group-by-query

Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
SQL Query for many2many แก้ไขแล้ว
13
ก.ค. 24
14253
1
ส.ค. 24
1313
customers & vendors query in pgAdmin แก้ไขแล้ว
3
พ.ย. 23
1584
0
ธ.ค. 21
2646
2
ก.พ. 19
9910