у меня есть таблица mysql со следующей структурой:
tblapp
app_id app_date app_price app_price_paid payment_id receipt_id expenses_enabled
1 01/01/2000 100 50 1 1 1
1 11/01/2000 10 20 3 2 0
1 21/01/2000 40 40 1 4 0
1 30/01/2000 30 30 2 1 1
Я хотел бы иметь в виде столбцов
YEAR DETAILS Jan Feb ... Dec TOTALS
и строк
1. Price = sum app_price where expenses_enabled=1
2. PricePaid = sum app_price_paid where expenses_enabled=1
3. No = sum app_price where expenses_enabled=1 and receipt_id=1
3. Yes = sum app_price where expenses_enabled=1 and receipt_id=0
Желание вывести:
Year Details Jan Feb ... Dec Totals
2020 Price 130 0 ... 0 130
2020 Price_Paid 80 0 ... 0 80
2020 No 80 0 ... 0 80
2020 Yes 0 0 ... 0 0
Возможно ли это.