Re: [sqlite] Is this a proper syntax?

2013-10-25 Thread Hick Gunter
Sorry, I forgot. I work almost exclusively with virtual tables... Gunter -Ursprüngliche Nachricht- Von: Igor Korot [mailto:ikoro...@gmail.com] Gesendet: Freitag, 25. Oktober 2013 09:57 An: General Discussion of SQLite Database Betreff: Re: [sqlite] Is this a proper syntax? Hi, Hick

Re: [sqlite] Is this a proper syntax?

2013-10-25 Thread Igor Korot
t; -Ursprüngliche Nachricht- > Von: Igor Korot [mailto:ikoro...@gmail.com] > Gesendet: Freitag, 25. Oktober 2013 01:35 > An: General Discussion of SQLite Database > Betreff: Re: [sqlite] Is this a proper syntax? > > Igor, > > > On Thu, Oct 24, 2013 at 12:57 PM, Igo

Re: [sqlite] Is this a proper syntax?

2013-10-25 Thread Hick Gunter
ON o.playerid = p.playerid; and add the values for the new fields during the initial load? -Ursprüngliche Nachricht- Von: Igor Korot [mailto:ikoro...@gmail.com] Gesendet: Freitag, 25. Oktober 2013 01:35 An: General Discussion of SQLite Database Betreff: Re: [sqlite] Is this a proper syntax? Igor

Re: [sqlite] Is this a proper syntax?

2013-10-25 Thread Kees Nuyt
On Thu, 24 Oct 2013 21:40:32 -0400, Igor Tandetnik wrote: >On 10/24/2013 9:17 PM, David Bicking wrote: >> But I think sqlite would notice that the subquery was the same in the >> UPDATE statement that Igor T gave and not run it twice > >I don't believe SQLite is quite that

Re: [sqlite] Is this a proper syntax?

2013-10-24 Thread Igor Korot
Thank you. That worked. On Thu, Oct 24, 2013 at 5:00 PM, Igor Tandetnik wrote: > On 10/24/2013 7:34 PM, Igor Korot wrote: > >> So I was thinking of something like this: >> >> UPDATE leagueplayers SET original_rank = (SELECT rank FROM players AS a), >> current_rank= a WHERE

Re: [sqlite] Is this a proper syntax?

2013-10-24 Thread Igor Tandetnik
On 10/24/2013 9:17 PM, David Bicking wrote: You could try REPLACE LEAGUEPLAYERS (playerid, leaqueid, original_rank, current_rank) SELECT L.playerid, L.leagueid, P.rank, P.rank FROM leagueplayers L INNER JOIN players P ON L.playerid = P.playerid; REPLACE (which is a shorthand for INSERT OR

Re: [sqlite] Is this a proper syntax?

2013-10-24 Thread David Bicking
On 10/24/2013 07:34 PM, Igor Korot wrote: Igor, On Thu, Oct 24, 2013 at 12:57 PM, Igor Tandetnik wrote: On 10/24/2013 3:23 PM, Igor Korot wrote: Will this query work: UPDATE a SET a.field1 = (SELECT b.field1 FROM b AS myfield), a.field2 = myfield... or I will have to

Re: [sqlite] Is this a proper syntax?

2013-10-24 Thread Igor Tandetnik
On 10/24/2013 7:34 PM, Igor Korot wrote: So I was thinking of something like this: UPDATE leagueplayers SET original_rank = (SELECT rank FROM players AS a), current_rank= a WHERE players.playerid = leagueplayers.playerid; But I guess this query will not work. ;-) Any idea how to make the

Re: [sqlite] Is this a proper syntax?

2013-10-24 Thread Igor Korot
Igor, On Thu, Oct 24, 2013 at 12:57 PM, Igor Tandetnik wrote: > On 10/24/2013 3:23 PM, Igor Korot wrote: > >> Will this query work: >> >> UPDATE a SET a.field1 = (SELECT b.field1 FROM b AS myfield), a.field2 = >> myfield... >> >> or I will have to repeat subquery for

Re: [sqlite] Is this a proper syntax?

2013-10-24 Thread Igor Tandetnik
On 10/24/2013 3:23 PM, Igor Korot wrote: Will this query work: UPDATE a SET a.field1 = (SELECT b.field1 FROM b AS myfield), a.field2 = myfield... or I will have to repeat subquery for a.field2? I'm pretty sure you will have to repeat the subquery. In your statement, myfield is an (unused)

Re: [sqlite] Is this a proper syntax?

2013-10-24 Thread Luuk
On 24-10-2013 21:23, Igor Korot wrote: Hi, ALL, Will this query work: UPDATE a SET a.field1 = (SELECT b.field1 FROM b AS myfield), a.field2 = myfield... or I will have to repeat subquery for a.field2? you only have to repeat the subquery if you want the new value of a.field2 to have the