diff --git a/internal/booking/service.go b/internal/booking/service.go index dbabbcf..10d72c7 100644 --- a/internal/booking/service.go +++ b/internal/booking/service.go @@ -118,14 +118,11 @@ func (bs Service) BuildReport(period string, month, year int) *Report { } bs.db.Raw(` - select id, customer_name, "from", "to", platform, total, platform_fees - from (select sum(price*quantity) as total, booking_id - from bookings - join items on bookings.id = items.booking_id - where "from" between ? and ? - group by booking_id) as sbi, - (select * from bookings) as b - where sbi.booking_id = b.id; + select bookings.id, customer_name, "from", "to", platform, sum(price * quantity) as total, platform_fees + from bookings + join items on bookings.id = items.booking_id + where "from" between ? and ? + group by bookings.id; `, startDate.Format("2006-01-02"), endDate.Format("2006-01-02")). Scan(&lines)