Re: [sqlite] Update of multiple columns

2007-06-18 Thread John Elrick

T wrote:
In case the original question has been clouded by discussions of 
running a general store and the arson habits of the Hand Crafted 
Guild, allow me to crystalize my purely SQLite question:


I know I can update via:

  update Table1
set
  c1 = (select d1 from Table2 where Table2.id = desired_id)
, c2 = (select d2 from Table2 where Table2.id = desired_id)
, c3 = (select d3 from Table2 where Table2.id = desired_id)
, cn = (select dn from Table2 where Table2.id = desired_id)
  where
rowid = desired_rowid

But that executes the same where clause n times, so scans through 
Table2 for a to find the same matching row n times.


Is it possible to construct an update that executes a where clause 
once to locate all of the desired columns?


The obvious solution would be to do it programatically, however, I'm 
guessing that doesn't meet your needs?



John

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Update of multiple columns

2007-06-18 Thread T
In case the original question has been clouded by discussions of  
running a general store and the arson habits of the Hand Crafted  
Guild, allow me to crystalize my purely SQLite question:


I know I can update via:

  update Table1
set
  c1 = (select d1 from Table2 where Table2.id = desired_id)
, c2 = (select d2 from Table2 where Table2.id = desired_id)
, c3 = (select d3 from Table2 where Table2.id = desired_id)
, cn = (select dn from Table2 where Table2.id = desired_id)
  where
rowid = desired_rowid

But that executes the same where clause n times, so scans through  
Table2 for a to find the same matching row n times.


Is it possible to construct an update that executes a where clause  
once to locate all of the desired columns?


Thanks,
Tom


-
To unsubscribe, send email to [EMAIL PROTECTED]
-