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 |
jameselmore
Starting Member
3 Posts |
Posted - 2013-06-13 : 12:49:28
|
Hello,I believe I'm using this function correctly but for every new partition of my data it assigns the first two rows a row number of one... This is what I currently have as my query:select a.callid, left(b.agent_id,9) as agent_id, b.RLA_datetime, a.answtime, a.disptime, on_off, Row_number() over (partition by agent_id order by a.disptime) rownum into #onetwo from #one a join #twoON b.connid = a.callid AND a.agentext = left(b.dn,5) AND b.agent_id IS NOT NULLORDER BY agent_id asc, disptime ascWhat could I be doing wrong? |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-06-13 : 12:54:15
|
yup and thats what partitioning needs to do. For agent_ID=1 and dispTime Acending the sequence will be created and soon the Agent_ID is changed a new sequence will be created.CheersMIK |
|
|
jameselmore
Starting Member
3 Posts |
Posted - 2013-06-13 : 12:58:23
|
No, what I'm saying is it will make 2 rownum = 1 in the same sequence..It looks something like thisAgent_ID rownum1 11 11 21 32 12 12 22 32 4I'm clear on what it SHOULD be doing, but it's not doing what it should |
|
|
jameselmore
Starting Member
3 Posts |
Posted - 2013-06-13 : 13:12:57
|
I figured it out.I'm calculating the row numbers as the table is being joined and the method which creates the rownumbers is being computed during the joining process or something, so it's coming up with a lot of weird things. I joined to a temp table and then made added the row numbers in a seperate query |
|
|
|
|
|
|
|