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.
Hi I 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, amount
I 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 this Unique Date Userid IncrementalNumber 31231 12/12/09 Jim 1 12313 14/12/09 Jim 2 34555 15/12/09 Mary 1 65455 17/12/09 Jim 3 76556 17/12/09 Mary 2 55554 26/12/09 Jim 4 44344 03/01/10 Jim 1 98777 03/01/10 Jim 2 21123 04/01/10 Jim 3 86756 04/01/10 Mary 1 45454 16/01/10 Mary 2
hope that makes sense |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
|
|