Trouble with array
Posted: Tue Aug 03, 2010 8:06 pm
Hello all,
Need a little help with grouping and summing using an array. I can't do this directly from the database because the vendor package we are using (Tivoli Data Warehouse) stores date in a proprietary format as a CHAR in the database and in GMT so I have to get the data first and then manipulate the date to get it human readable and in the right EST date.
I have my query (and my date conversion) from the database returning the data in a format that looks like this:
The reason each date has the service repeated is because it was selected from the database by hour (needed to convert Tivoli's weird timestamp and use of GMT)
Service TX_Count Date
-------------------------------------------------------------------------------------------
Service1 23451 2010-01-01
Service1 93874 2010-01-01
Service1 82363 2010-01-01
Service1 56245 2010-01-02
Service1 73453 2010-01-02
Service1 18965 2010-01-02
I have successfully gotten the data in to an array and I can group by date and then sum the tx_count, or I can group the services and sum the tx_count.
What I really need to be able to do is to get the transaction counts by service by day so that I would get something like this as a result
Service1 2010-01-01 199688
Service1 2010-01-02 148663
So I need to group by service and then date and then sum it all out of the array.
Any advice and direction is appreciated
Need a little help with grouping and summing using an array. I can't do this directly from the database because the vendor package we are using (Tivoli Data Warehouse) stores date in a proprietary format as a CHAR in the database and in GMT so I have to get the data first and then manipulate the date to get it human readable and in the right EST date.
I have my query (and my date conversion) from the database returning the data in a format that looks like this:
The reason each date has the service repeated is because it was selected from the database by hour (needed to convert Tivoli's weird timestamp and use of GMT)
Service TX_Count Date
-------------------------------------------------------------------------------------------
Service1 23451 2010-01-01
Service1 93874 2010-01-01
Service1 82363 2010-01-01
Service1 56245 2010-01-02
Service1 73453 2010-01-02
Service1 18965 2010-01-02
I have successfully gotten the data in to an array and I can group by date and then sum the tx_count, or I can group the services and sum the tx_count.
What I really need to be able to do is to get the transaction counts by service by day so that I would get something like this as a result
Service1 2010-01-01 199688
Service1 2010-01-02 148663
So I need to group by service and then date and then sum it all out of the array.
Any advice and direction is appreciated