Hello, I've got a question for my SQL query I've got too write. It's a long time ago since I've written an query so I could use some help with mine. I've tried looking for examples but didn't find the right result. Ive written an query but its really isn't working for me.. What im trying to do is get the sum of the total power consumption for each date in my database. My table looks like:
|HistoryProbes|
|-------------|
|id (int) pk |
|timestamp (datetime) formatted as: "yyyy-MM-ddTHH:mm:ss"|
|PowerConsumption (int)|
I've found a sample that did quite work.. But it isnt the best solution for me.. it can be found at : http://cephas.net/blog/2005/12/06/sql-server-group-by-datetime/
So far i got this working
SELECT distinct CONVERT(varchar, timestamp, 111) AS thedate
FROM HistoryProbes
I got values 25/11/2009 and 24/11/2009 but i cant manage to get the sum of the PowerConsumption
Thanks.