[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ok, maybe it isn't worth upgrading all the data...



On Mon, Dec 5, 2011 at 1:16 PM,  <..hidden..> wrote:
>
> Is there more than just running the query?
>
> hethcote=# UPDATE parts SET income_accno_id = (SELECT account.id
> .
Here is the versoin that made it into Fixes.sql


UPDATE parts
   SET income_accno_id = (SELECT account.id
                            FROM account JOIN lsmb12.chart USING (accno)
                           WHERE chart.id = income_accno_id),
       expense_accno_id = (SELECT account.id
                            FROM account JOIN lsmb12.chart USING (accno)
                           WHERE chart.id = expense_accno_id),
       inventory_accno_id = (SELECT account.id
                            FROM account JOIN lsmb12.chart USING (accno)
                           WHERE chart.id = inventory_accno_id)
 WHERE id IN (SELECT id FROM lsmb12.parts op
               WHERE op.id = parts.id
                     AND (op.income_accno_id = parts.income_accno_id
                          OR op.inventory_accno_id = parts.inventory_accno_id
                          or op.expense_accno_id = parts.expense_accno_id));

I think the issue is that the previous one only updated parts, not services etc.