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 |
icw
Constraint Violating Yak Guru
378 Posts |
Posted - 2010-01-14 : 10:23:20
|
Hi I originally posted this into the wrong forum.HiI don't know how to do this.I have a sales table.The table has the following columns (this is simplified of course)Date, Userid, UniqueSaleid, Product, amountI want to do a query that will add an incremental number column. but the number has to reset each month for each user.E.g. the results might look like thisUnique Date Userid IncrementalNumber 31231 12/12/09 Jim 1 12313 14/12/09 Jim 234555 15/12/09 Mary 165455 17/12/09 Jim 376556 17/12/09 Mary 255554 26/12/09 Jim 444344 03/01/10 Jim 198777 03/01/10 Jim 221123 04/01/10 Jim 386756 04/01/10 Mary 145454 16/01/10 Mary 2hope that makes sense |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
|
|