hotel=# SELECT
hotel-# "public".billing.id, hotel-# "public".billing.guest_id, hotel-# "public".billing.trx_date, hotel-# "public".billing.trx_time, hotel-# "public".billing.payment_method, hotel-# "public".billing.tax, hotel-# "public".billing.dep_id, hotel-# "public".department."name", hotel-# SUM("public".items.price) AS total, hotel-# "public".billing.amount_paid hotel-# FROM hotel-# "public".billing_items hotel-# INNER JOIN "public".billing ON ("public".billing_items.billing_id = "public".billing.id) hotel-# INNER JOIN "public".department ON ("public".billing.dep_id = "public".department.id) hotel-# INNER JOIN "public".items ON ("public".billing_items.items_id = "public".items.id) hotel-# GROUP BY "public".billing.id; ERROR: Attribute billing.guest_id must be GROUPed or used in an aggregate function hotel=# What Worng ??
How to using SUM() & GROUP
BY
|
- Re: [SQL] SUM() & GROUP BY Muhyiddin A.M Hayat
- Re: [SQL] SUM() & GROUP BY Oliver Elphick
- Re: [SQL] SUM() & GROUP BY Muhyiddin A.M Hayat
- Re: [SQL] SUM() & GROUP BY Muhyiddin A.M Hayat
- Re: [SQL] SUM() & GROUP BY Martin Kuria
- Re: [SQL] SUM() & GROUP BY Richard Huxton
- Re: [SQL] SUM() & GROUP BY Martin Kuria
- Re: [SQL] SUM() & GROUP BY Richard Huxton
- Re: [SQL] SUM() & GROUP BY Jean-Luc Lachance