Question : SQL Syntax

I have a table that has a position indicator for the main ID. Its a 1 to many table. When a new record for an account that already exists gets another row inserted I need to evaulate the position. If the position already exists I need to move all the other ones down. Heres an example

acctID     Value     Position
123           John          1
123           James       2
123           Peter         3

If I insert a value of Paul with a position of 2 I need to move AcctID 123 and update their positions...Heres an example

Insert Into tableA
Select 123, Paul, 2

Heres what I would need the table to look like

acctID     Value     Position
123           John          1
123           Paul           2 (new position inserted)
123           James       3 (position moved down)
123           Peter         4 (position moved down)

Hope this makes sense...Thanks

Answer : SQL Syntax

I would think that would take two statements:
1:
2:
3:
Update tableA set position = position + 1 where acctid = 123 and position >= 2;

Insert Into tableA Select 123, Paul, 2;
Random Solutions  
 
programming4us programming4us