IDK if this is possible or not but I haven't been able to find an answer that quite fits my situation... With cte AS ( SELECT col1, col2, col3, ROW_NUMBER() OVER (PARTITION BY col1,col2,col3 ORDER BY col3) AS coolcol FROM table ) SELECT * FROM cte ... Great, this partitions based on my 3 columns and gives me numbers for each of those. What I want to do is where 'coolrow' = 1 AND 'col3' = 1 to insert a row above with my specified values. I also need to be able to insert different values where 'col3' = 0. Any guidance would be much appreciated, this is cool stuff for me but probably basic for most of you guys. Thanks!