I have an MySQL table that looks like this:

primary key | ID | date
----------+--+------------
1                  | 1  | 2008-09-09
2                  | 1  | 2008-09-10
3                  | 2  | 2008-09-09
4                  | 2  | 2008-09-13


…where ID is a reference to something that happens multiple times.

I want to to display the content of the table like this:

ID 1: (sum of all rows with ID 1)
ID 2: (sum of all rows with ID 2)
ID 3: (sum of all rows with ID 3)


…or exactly how it would look…

1: 5
2: 2
3: 16


…etc.


I can do this by performing a query for each ID, but would like to know if it is possible to retrieve all of the data with a single query.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to