count and group by question
От | |
---|---|
Тема | count and group by question |
Дата | |
Msg-id | Pine.LNX.4.33.0206191430010.11690-100000@paymentalliance.net обсуждение исходный текст |
Список | pgsql-hackers |
I have a query which contains both a group by and a count, e.g: SELECT to_char(pa_shopping_cart.delivery_date, 'FMMM/FMDD/YY') AS delivery_date, pa_products.product_name AS product_name, pa_orders.order_state AS state, count(*) AS count FROM pa_shopping_cart, pa_products, pa_orders WHERE pa_shopping_cart.order_id = pa_orders.order_id AND pa_shopping_cart.product_id = pa_products.product_id GROUP BY pa_shopping_cart.delivery_date, pa_products.product_name, pa_orders.order_state ORDER BY pa_shopping_cart.delivery_date, pa_products.product_name; This query is really handy because it gives me the count of each product grouping by delivery within each possible order state. Here's the question - I would like to get the count of how many tuples are returned total. With most queries, count(*) works great for this purpose, however I need something that will give me the total count of tuples returned even when there is a grouping. Any ideas? Ryan Mahoney
В списке pgsql-hackers по дате отправления: