Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ricc
Starting Member
16 Posts |
Posted - 2005-08-04 : 09:45:30
|
| Hi, I'm having some difficulty creating the SQL Statement for getting some data from a table:I have the following table of data__User___Votes___Month__A_______14______2__A_______12______3__A_______17______4__A_______11______5__B_______19______2__B_______12______3__B_______15______4I want to beable to pull out the total number of votes a user has had over a period of months. eg Total up each users users votes for months 4 and 5that would give:__User____TotalVotes___A________28___B________15An added complecation is that user B does not have any data for month 5Any help or pointers would be fanstaticMany thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-04 : 09:58:29
|
| Select [user],sum(vote) as TotalVotes from yourtable where month between 4 and 5 group by [user]MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|