Re: [sqlite] SET (x,y) = (x1,y1)?

2014-09-15 Thread Petite Abeille
On Sep 15, 2014, at 7:08 PM, Hick Gunter wrote: > Maybe you can reformulate the query to fit > > INSERT OR UPDATE INTO t SELECT t.a,t.b,...,s.x,s.y FROM t, s … There is no such a thing as 'INSERT OR UPDATE’ in SQLite. There is a ‘REPLACE’, but it’s definitively not the same

Re: [sqlite] SET (x,y) = (x1,y1)?

2014-09-15 Thread Hick Gunter
Maybe you can reformulate the query to fit INSERT OR UPDATE INTO t SELECT t.a,t.b,...,s.x,s.y FROM t, s ... -Ursprüngliche Nachricht- Von: Mark Lawrence [mailto:no...@null.net] Gesendet: Montag, 15. September 2014 10:51 An: sqlite-users@sqlite.org Betreff: [sqlite] SET (x,y) = (x1,y1

Re: [sqlite] SET (x,y) = (x1,y1)?

2014-09-15 Thread John McKown
On Mon, Sep 15, 2014 at 10:21 AM, Dennis Jenkins wrote: > This construct does not work in postgresql 9.3.5 (unless I have a typo). > > However, I would love for it to work in both Postgresql and Sqlite. > > > djenkins@ostara ~ $ psql -Upostgres -dcapybara_regtest >

Re: [sqlite] SET (x,y) = (x1,y1)?

2014-09-15 Thread Dennis Jenkins
This construct does not work in postgresql 9.3.5 (unless I have a typo). However, I would love for it to work in both Postgresql and Sqlite. djenkins@ostara ~ $ psql -Upostgres -dcapybara_regtest psql (9.3.5) Type "help" for help. capybara_regtest=# create table test1 (col1 integer, col2

Re: [sqlite] SET (x,y) = (x1,y1)?

2014-09-15 Thread Mark Lawrence
On Mon Sep 15, 2014 at 10:51:04AM +0200, Mark Lawrence wrote: > > Normally one could use a CTE to do the work once: > > WITH > cte > AS ( > SELECT 1 AS x, 2 AS y > ) > UPDATE > t > SET > x = cte.x, > y = cte.y > ; Actually

[sqlite] SET (x,y) = (x1,y1)?

2014-09-15 Thread Mark Lawrence
I occasionally have the need to update two columns based on complex sub queries, which are often very similar UPDATE t SET x = ( SELECT 1...), y = ( SELECT 2...)-- nearly the same as SELECT 1 ; Normally one could use a CTE to do the work once: WITH