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] confusing with how to to this in sqlite

2008-12-23 Thread Simon Davies
2008/12/23 Rachmat Febfauza :
> =
>
> thanks to Simon. it works. but i have some question. i hope u can help me 
> to explain these :
>
> 1. is it necessary or not to specify min(awal1.begin).

No. "Begin" is part of the 'group by' clause. Each distinct value of
"Begin" will be represented in the result set.

> 2. is "min(strftime("%s",akhir1."End")-strftime("%s",awal1."Begin")) as 
> Difference" is more time consuming to compute than 
> "strftime("%s",min(akhir1."End"))-strftime("%s",awal1."Begin") as 
> Difference". i think these give the same result.

Not sure. Can see no reason for there to be a significant performance
difference.


> 3. akhir1.Category like awal1.Category || '%'. what does it mean? why is use 
> || '%'???. why not to write "awal1.category = akhir1.category". it also give 
> the same result.

It does not give the same result with your originally posted data set.
The like operator matches similar text values; '%' is a wildcard.

See http://www.sqlite.org/lang_expr.html#like

>
> once again, i would say thank you for ur solution. sory for my bad english.
>

You're welcome,
Rgds,
Simon
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] UPDATE a ROW based on an UPDATE of a different ROW

2008-12-23 Thread jose isaias cabrera

"Igor Tandetnik" wrote...

>> As you can see, this UPDATE,
>>
>> UPDATE foo SET bdate = (SELECT f2.edate FROM foo f1 JOIN foo
>> f2 ON f1.PID = f2.PID AND f1.lang = f2.lang WHERE f1.job = 'val' AND
>> f2.job = 'trans' AND f1.id = foo.id AND f1.bdate < f2.edate)
>> WHERE foo.job = 'val';
>>
>> clears the bdate of line 6, but 4 and 5 worked correctly.  I did some
>> searches on the internet to try to find out how to get it to work,
>> but could not figure it out.  I thought of a CASE, but couldn't
>> figure it out. Newbie, of course.  What I would like to do is to
>> update the bdates of the 'val' jobs with the edate of the 'trans' job
>> of the corresponding lang, only if the bdate of the 'val' job is <
>> the edate of the 'trans' job.  I hope I am clear enough to get some
>> help.
>
> update foo set bdate = coalesce(
>  (select f1.edate from foo f1
>   where f1.job='trans' and f1.PID=foo.PID and
> f1.lang=foo.lang and foo.bdate < f2.edate),
>  bdate)
> where job = 'val';
>


thanks, Igor.

josé 

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


Re: [sqlite] INVALID COMMAND NAME sqlite3_soft_heap_limit

2008-12-23 Thread mkrajachandru
Hello All,

  Thank U V V V much Dan & Shane Harrelson ...

  Its working fine 

  So we are going for a party I am inviting u guys also for the
party.

Thanks and regards

Chandru

On Tue, Dec 23, 2008 at 10:24 AM, Shane Harrelson  wrote:

> If you use the supplied makefile, "make fulltest" should build the
> testfixture and run the all.test set.  The testfixture is similar to the
> sqlite3 CLI except that it includes a TCL interpreter as well as an
> extensive set of test harnesses for virtually every part of the SQLite
> core.
>
> On Mon, Dec 22, 2008 at 9:05 AM,  wrote:
>
> > Hello Dan,
> >
> > Thank U for ur reply..
> >
> > Could you please let me know more about testfixture.
> >
> > Also, please forward releated links
> >
> > Thanks
> > Chandru
> >
> >
> >
> > On Mon, Dec 22, 2008 at 3:06 PM, Dan  wrote:
> >
> > >
> > > On Dec 22, 2008, at 3:55 PM, mkrajachan...@gmail.com wrote:
> > >
> > > > Hello all,
> > > >
> > > > While i am trying to run the all.test file through the tcl shell
> > > >
> > > > I am getting the following error
> > > >
> > > >
> > > > # tclsh all.test
> > > > invalid command name "sqlite3_soft_heap_limit"
> > > >while executing
> > > > "sqlite3_soft_heap_limit $soft_limit"
> > > >(file "./tester.tcl" line 50)
> > > >invoked from within
> > > > "source $testdir/tester.tcl"
> > > >(file "all.test" line 16)
> > > > #
> > > >
> > > > how can i getrid of this problem
> > > >
> > > > Thanks in advance
> > >
> > > You need to build and use 'testfixture', not the regular sqlite3
> > > tcl shell, to run the test suite. Are you doing so?
> > >
> > > ___
> > > 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
> >
> ___
> 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