I have three tables (users, books, pencils) and would like to get a
list of all users with a count and total price of their books and
pencils for 2012-01-01...
So with this data...
users (user_id)
1
2
3
books (user_id, price, created)
1 | $10 | 2012-01-01
1 | $10 | 2012-01-01
3 | $10 |
Hi Nick,
On 17/01/12 00:18, Nick wrote:
I have three tables (users, books, pencils) and would like to get a
list of all users with a count and total price of their books and
pencils for 2012-01-01...
So with this data...
users (user_id)
1
2
3
books (user_id, price, created)
1 | $10 |
On Jan 17, 3:33 am, t...@audioboundary.com (Tom Molesworth) wrote:
Hi Nick,
On 17/01/12 00:18, Nick wrote:
I have three tables (users, books, pencils) and would like to get a
list of all users with a count and total price of their books and
pencils for 2012-01-01...
So with
On Jan 17, 3:33 am, t...@audioboundary.com (Tom Molesworth) wrote:
Hi Nick,
On 17/01/12 00:18, Nick wrote:
I have three tables (users, books, pencils) and would like to get a
list of all users with a count and total price of their books and
pencils for 2012-01-01...
So with
On Jan 17, 3:33 am, t...@audioboundary.com (Tom Molesworth) wrote:
Hi Nick,
On 17/01/12 00:18, Nick wrote:
I have three tables (users, books, pencils) and would like to get a
list of all users with a count and total price of their books and
pencils for 2012-01-01...
So with
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Nick
Sent: Tuesday, January 17, 2012 12:59 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Whats the most efficient query for this result?
On Jan 17, 3:33 am, t
On 17/01/12 17:51, Nick wrote:
On Jan 17, 3:33 am, t...@audioboundary.com (Tom Molesworth) wrote:
Hi Nick,
On 17/01/12 00:18, Nick wrote:
What is the most efficient way to get this result...
query_result (user_id, book_count, book_price_total, pencil_count,
pencil_price_total)
1 | 2 | $20 |
On Jan 17, 2012, at 21:08, Tom Molesworth t...@audioboundary.com wrote:
On 17/01/12 17:51, Nick wrote:
On Jan 17, 3:33 am, t...@audioboundary.com (Tom Molesworth) wrote:
Looking at it again, I think the missing part is the created fields - you'll
probably need both of those in the group by