Thank you Igor, that works great.  

Is there a FAQ or page somewhere that would help me understand how
inter-table comparisons like this work?  I'd like to be able to do more
of them (without asking for help if possible).


-----Original Message-----
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 30, 2006 5:08 PM
To: SQLite
Subject: [sqlite] Re: SQL that is stumping me

Doug Nebeker <[EMAIL PROTECTED]>
wrote: 
> Imagine I have the following data:
> 
> TimeStamp | Person | Data1
> -------------------------------
> 1         | Doug   | X
> 2         | Doug   | Y
> 2         | Fred   | A
> 3         | Doug   | Z
> 4         | Fred   | B
> 
> How do I set all Data1 values for each person to the _first_ value 
> that was seen for them (X for all Doug Data1 values, A for all Fred 
> Data1 values)?

update tableName set data1 =
    (select data1 from tableName t2 where t2.Person=tableName.Person
     order by t2.TimeStamp limit 1);

Igor Tandetnik

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



This email was sent to you by Reuters, the global news and information company. 
To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.


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

Reply via email to