Re: [sqlite] Math Update with two tables

2008-12-23 Thread Igor Tandetnik
"Dusan Gibarac" 
wrote in message news:4951940f@cbsits.com
> There are tables t1( f11, f12) and table t2(f21, f22) and one
> has to update field t1.f12 with values t2.f22 where t1.f11 = t2.f21.

update t1 set f12 = (select f22 from t2 where f11 = f21);

Igor Tandetnik 



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Math Update with two tables

2008-12-23 Thread Dusan Gibarac
There are tables t1( f11, f12) and table t2(f21, f22) and one
has to update field t1.f12 with values t2.f22 where t1.f11 = t2.f21.

Mysql sample:

   1.
  UPDATE t1, t2
   2.
  SET t1.f12 = t2.f22
   3.
  WHERE t1.f11 = t2.f21

He needs SQLite syntax.

Dusan.



Igor Tandetnik wrote:
> Dusan Gibarac  wrote:
>   
>> Igor Tandetnik wrote:
>> 
>>> "aj"  wrote in
>>> message
>>> news:95d3c7350812201131l1cd87998k55595f77fecc0...@mail.gmail.com
>>>
>>>   
 UPDATE Records,Table2
 SET  Factors= (Factors * Potential Table2.Field23)

 
>>> This last statement makes no sense ot me. Could you describe, in
>>> plain English, what it was supposed to achieve?
>>>   
>> He wants to update table Records using data from table Table2.
>> 
>
> Hey, give me _some_ credit - I figured out as much. It's not clear 
> precisely which pieces of data from Table2 should affect which records 
> of Records, and in what way. What's the relationship between the two 
> tables?
>
> Igor Tandetnik 
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>   
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Math Update with two tables

2008-12-23 Thread Igor Tandetnik
Dusan Gibarac  wrote:
> Igor Tandetnik wrote:
>> "aj"  wrote in
>> message
>> news:95d3c7350812201131l1cd87998k55595f77fecc0...@mail.gmail.com
>>
>>> UPDATE Records,Table2
>>> SET  Factors= (Factors * Potential Table2.Field23)
>>>
>>
>> This last statement makes no sense ot me. Could you describe, in
>> plain English, what it was supposed to achieve?
>
> He wants to update table Records using data from table Table2.

Hey, give me _some_ credit - I figured out as much. It's not clear 
precisely which pieces of data from Table2 should affect which records 
of Records, and in what way. What's the relationship between the two 
tables?

Igor Tandetnik 



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Math Update with two tables

2008-12-23 Thread Dusan Gibarac
He wants to update table Records using data from table Table2.

Dusan.



Igor Tandetnik wrote:
> "aj"  wrote in
> message
> news:95d3c7350812201131l1cd87998k55595f77fecc0...@mail.gmail.com
>   
>> I would like to use math with more then one table, for example
>> I know how to do this
>>
>>
>> (Factors & Potential = columns)
>>
>> UPDATE Records
>> SET  Factors= (Factors * Potential)
>>
>> but i don't know how with an additional table, i came up with
>>
>>
>> UPDATE Records,Table2
>> SET  Factors= (Factors * Potential Table2.Field23)
>> 
>
> This last statement makes no sense ot me. Could you describe, in plain 
> English, what it was supposed to achieve?
>
> Igor Tandetnik 
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>   
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Math Update with two tables

2008-12-20 Thread Igor Tandetnik
"aj"  wrote in
message
news:95d3c7350812201131l1cd87998k55595f77fecc0...@mail.gmail.com
> I would like to use math with more then one table, for example
> I know how to do this
>
>
> (Factors & Potential = columns)
>
> UPDATE Records
> SET  Factors= (Factors * Potential)
>
> but i don't know how with an additional table, i came up with
>
>
> UPDATE Records,Table2
> SET  Factors= (Factors * Potential Table2.Field23)

This last statement makes no sense ot me. Could you describe, in plain 
English, what it was supposed to achieve?

Igor Tandetnik 



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users