<div><div>I have to update the column(Chart_Position) based on the order of column(sales) each week. So I guess dream code</div><div><br></div><div>would look like Update T1 Set Chart_Position = Temprecid ORDER BY Sales DESC</div>
<div><br></div><div>I had an alternative way before Valentina but it doesn't seem possible now because ORDER BY is not allowed to be used in INSERT statements, and I'm not knowledgeable of cursors or procedures so any help is appreciated. Heres the code I developed before.</div>
<div><br></div><div><div>BEGIN TRANSACTION;</div><div>CREATE TEMPORARY TABLE chart_backup(Act String,Sales Long,Chart_Position BYTE);</div><div>INSERT INTO chart_backup SELECT Discs.Act, Discs.Sales, Discs.Chart_Position FROM Discs ORDER BY Sales Desc;</div>
<div>CREATE TABLE newchart(Act String,Sales Long,Chart_Position BYTE;</div><div>INSERT INTO newchart(Act,Sales,chart_backup) SELECT Act,Sales,Chart_Position FROM chart_backup</div><div>COMMIT;</div><div>update Discs Set P=(Select recid from chart_backup WHERE chart_backup.Sales=Discs.Sales)</div>
</div><br>-- <br>Wolverine Studios,<br>Lead Developer of MWR<br>
</div>