Re: [sqlite] Syntax error using CTE and UPDATE

2017-09-04 Thread David Wellman
] Syntax error using CTE and UPDATE One last thing I forgot to mention, on the topic of making INSERT and UPDATE easy - If you are using SQLite 3.15 or later, you can use Row-value functionality to UPDATE several fields in one go from a sub query. An example of how such an update query might look

Re: [sqlite] Syntax error using CTE and UPDATE

2017-09-04 Thread R Smith
One last thing I forgot to mention, on the topic of making INSERT and UPDATE easy - If you are using SQLite 3.15 or later, you can use Row-value functionality to UPDATE several fields in one go from a sub query. An example of how such an update query might look: WITH CTE(ID, ta, tb, tc) AS

Re: [sqlite] Syntax error using CTE and UPDATE

2017-09-04 Thread R Smith
On 2017/09/04 12:46 PM, David Wellman wrote: Hi Ryan, Thanks for that. It is certainly valid syntax and I'll do some testing to check that it gives me the correct answer. It's always a pleasure. Your email has 'crossed in the post' with my second one and you've answered something that I

Re: [sqlite] Syntax error using CTE and UPDATE

2017-09-04 Thread David Wellman
: Re: [sqlite] Syntax error using CTE and UPDATE You are essentially trying to use a CTE (which for the intents and purposes of the UPDATE SQL is just the same as using any other table) inside an UPDATE statement as if it is the main referenced table. In an UPDATE or INSERT however, there can

Re: [sqlite] Syntax error using CTE and UPDATE

2017-09-04 Thread David Wellman
- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of David Wellman Sent: 04 September 2017 11:23 To: 'SQLite mailing list' Subject: [sqlite] Syntax error using CTE and UPDATE Hi, (I have a feeling that this will be depressingly simple - but I just can't see

Re: [sqlite] Syntax error using CTE and UPDATE

2017-09-04 Thread R Smith
You are essentially trying to use a CTE (which for the intents and purposes of the UPDATE SQL is just the same as using any other table) inside an UPDATE statement as if it is the main referenced table. In an UPDATE or INSERT however, there can only ever be 1 single main referenced table

[sqlite] Syntax error using CTE and UPDATE

2017-09-04 Thread David Wellman
Hi, (I have a feeling that this will be depressingly simple - but I just can't see it right now.) The following code is failing with: Error: near line 3: no such column: dtls.mapname2 explain with dtls as (select distinct wrk.mapname as mapname2 ,udb.udb_key

Re: [sqlite] syntax error near AS

2017-07-06 Thread John McMahon
On 06/07/2017 17:01, Domingo Alvarez Duarte wrote: I already did this before but it was not accepted. For myself I did a modification on sqlite3 to allow the use of "AS" on delete/update statements. You can see the parser part here

Re: [sqlite] syntax error near AS

2017-07-06 Thread John McMahon
ror message if they are not the same as the updated table). -- ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of John McMahon Sent: Wednesday, 5 July, 2017 21:17 To: SQLite Users Subjec

Re: [sqlite] syntax error near AS

2017-07-06 Thread John McMahon
On 06/07/2017 16:33, Clemens Ladisch wrote: John McMahon wrote: an alias for an "UPDATE" table name is not permitted. Is there a particular reason for this? The UPDATE statement affects a single table. While an alias might be a convenience, it is not necessary (any naming conflicts in

Re: [sqlite] syntax error near AS

2017-07-06 Thread John McMahon
On 06/07/2017 15:03, Keith Medcalf wrote: Do you know of any implementation of SQL that accepts an AS clause for the updated table? I don't think any do. No Keith, I don't. My only exposure to SQL is sqlite. Some versions have a FROM extension and you CAN specify an alias for the

Re: [sqlite] syntax error near AS

2017-07-06 Thread John McMahon
On 06/07/2017 17:01, Domingo Alvarez Duarte wrote: I already did this before but it was not accepted. For myself I did a modification on sqlite3 to allow the use of "AS" on delete/update statements. You can see the parser part here

Re: [sqlite] syntax error near AS

2017-07-06 Thread John McMahon
On 06/07/2017 16:33, Clemens Ladisch wrote: John McMahon wrote: an alias for an "UPDATE" table name is not permitted. Is there a particular reason for this? The UPDATE statement affects a single table. While an alias might be a convenience, it is not necessary (any naming conflicts in

Re: [sqlite] syntax error near AS

2017-07-06 Thread John McMahon
ror message if they are not the same as the updated table). -- ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of John McMahon Sent: Wednesday, 5 July, 2017 21:17 To: SQLite Users Subjec

Re: [sqlite] syntax error near AS

2017-07-06 Thread John McMahon
On 06/07/2017 15:03, Keith Medcalf wrote: Do you know of any implementation of SQL that accepts an AS clause for the updated table? I don't think any do. No Keith, I don't. My only exposure to SQL is sqlite. Some versions have a FROM extension and you CAN specify an alias for the

Re: [sqlite] syntax error near AS

2017-07-06 Thread Domingo Alvarez Duarte
I already did this before but it was not accepted. For myself I did a modification on sqlite3 to allow the use of "AS" on delete/update statements. You can see the parser part here https://github.com/mingodad/sqlite/blob/decimal64/src/parse.y . Cheers ! On 06/07/17 05:16, John McMahon

Re: [sqlite] syntax error near AS

2017-07-06 Thread Clemens Ladisch
John McMahon wrote: > an alias for an "UPDATE" table name is not permitted. Is there a particular > reason for this? The UPDATE statement affects a single table. While an alias might be a convenience, it is not necessary (any naming conflicts in subqueries can be resolved by using an alias on

Re: [sqlite] syntax error near AS

2017-07-06 Thread Paul Sanderson
ıɥʇ pɐǝɹ uɐɔ noʎ ɟı > > > -Original Message- > > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > > On Behalf Of John McMahon > > Sent: Wednesday, 5 July, 2017 21:17 > > To: SQLite Users > > Subject: [sqlite] syntax error nea

Re: [sqlite] syntax error near AS

2017-07-05 Thread Keith Medcalf
sıɥʇ pɐǝɹ uɐɔ noʎ ɟı > -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of John McMahon > Sent: Wednesday, 5 July, 2017 21:17 > To: SQLite Users > Subject: [sqlite] syntax error near AS > > Hi > > Wondering if someo

[sqlite] syntax error near AS

2017-07-05 Thread John McMahon
Hi Wondering if someone else can spot the syntax error in the following statement. "locns" is an attached database. There are four "AS" terms in the statement, they all alias tables. Ok, found it. It seems that an alias for an "UPDATE" table name is not permitted. Is there a particular

[sqlite] syntax error on SELECT with WHERE EXISTS

2016-01-18 Thread R Smith
On 2016/01/18 11:42 PM, James Walker wrote: > Why do I get a syntax error from this SQL? > > SELECT * FROM SnappedFrames WHERE EXISTS (SELECT 1 FROM > FilmSizeOverrides); > > SQLite says the error is near SELECT, but doesn't say which SELECT. > If I say either It works fine for me - What

[sqlite] syntax error on SELECT with WHERE EXISTS

2016-01-18 Thread Richard Hipp
On 1/18/16, James Walker wrote: > Why do I get a syntax error from this SQL? > > SELECT * FROM SnappedFrames WHERE EXISTS (SELECT 1 FROM FilmSizeOverrides); > > SQLite says the error is near SELECT, but doesn't say which SELECT. Works when I try it. Is there a stray non-printing character

[sqlite] syntax error on SELECT with WHERE EXISTS

2016-01-18 Thread James Walker
On 1/18/2016 1:59 PM, R Smith wrote: > > > On 2016/01/18 11:42 PM, James Walker wrote: >> Why do I get a syntax error from this SQL? >> >> SELECT * FROM SnappedFrames WHERE EXISTS (SELECT 1 FROM >> FilmSizeOverrides); >> >> SQLite says the error is near SELECT, but doesn't say which SELECT. If >>

[sqlite] syntax error on SELECT with WHERE EXISTS

2016-01-18 Thread James Walker
Why do I get a syntax error from this SQL? SELECT * FROM SnappedFrames WHERE EXISTS (SELECT 1 FROM FilmSizeOverrides); SQLite says the error is near SELECT, but doesn't say which SELECT. If I say either SELECT * FROM SnappedFrames WHERE 1; or SELECT 1 FROM FilmSizeOverrides; then there's

Re: [sqlite] Syntax error on CREATE TRIGGER IF NOT EXISTS

2010-05-28 Thread Jim Terman
sqlite 3.3.6. I didn't realize it was so old. Thanks. Igor Tandetnik wrote: > Jim Terman wrote: > >> It looks like to me that CREATE TRIGGER IF NOT EXISTS is recognized by >> sqlite, but I get the following from the command line: >> >> sqlite> CREATE TABLE foo (id INTEGER

Re: [sqlite] Syntax error on CREATE TRIGGER IF NOT EXISTS

2010-05-28 Thread Igor Tandetnik
Jim Terman wrote: > It looks like to me that CREATE TRIGGER IF NOT EXISTS is recognized by > sqlite, but I get the following from the command line: > > sqlite> CREATE TABLE foo (id INTEGER PRIMARY KEY, value TEXT, > timestamp DATE);sqlite> CREATE TRIGGER IF NOT EXISTS foo_log

[sqlite] Syntax error on CREATE TRIGGER IF NOT EXISTS

2010-05-28 Thread Jim Terman
It looks like to me that CREATE TRIGGER IF NOT EXISTS is recognized by sqlite, but I get the following from the command line: sqlite> CREATE TABLE foo (id INTEGER PRIMARY KEY, value TEXT, timestamp DATE);sqlite> CREATE TRIGGER IF NOT EXISTS foo_log AFTER INSERT ON foo BEGIN INSERT INTO foo

Re: [sqlite] Syntax error

2008-10-16 Thread Igor Tandetnik
"Darryl Hebbes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I am getting a syntax error like this : > > near ".": syntax error > > when I run the following code. > > > UPDATE site_profile > SET site_profile.title = (select site_profiletemp.title from Make it SET title =

[sqlite] Syntax error

2008-10-16 Thread Darryl Hebbes
Hi, I am getting a syntax error like this : near ".": syntax error when I run the following code. UPDATE site_profile SET site_profile.title = (select site_profiletemp.title from site_profiletemp where site_profile.title = site_profiletemp.title), site_profile.title = (select

Re: [sqlite] syntax error

2007-10-24 Thread Markus Hoenicka
Quoting nishit sharma <[EMAIL PROTECTED]>: Hi All, Sending y peoples same query with some explanation. i have a database name myds.db which is having one column as index (integer default 0) which has no values in complete database. when i used to access somthing with reference to index in

[sqlite] syntax error

2007-10-24 Thread nishit sharma
Hi All, Sending y peoples same query with some explanation. i have a database name myds.db which is having one column as index (integer default 0) which has no values in complete database. when i used to access somthing with reference to index in command than i get the error SQL error: near

[sqlite] syntax error

2007-10-24 Thread nishit sharma
Hi All, i have a database in which there is a column named index (integer value). when i m doing select index and all other stuff i m continuosly getting an error that is: SQL error: near "index": syntax error and this error doesn't come if i remove index entry from my command can anybody tell me

Re: [sqlite] Syntax Error

2006-11-19 Thread John Stanton
Clara Kinner wrote: Ah yes! I tried a dos prompt last night, but it wouldn't work... didn't like the directory or something odd. I moved the sqlite3 program to the C:\ dir and it worked.But now I have no idea where it created the test.db! Haha... Thank you for your help! Clara Trevor

Re: [sqlite] Syntax Error

2006-11-19 Thread Clara Kinner
Ah yes! I tried a dos prompt last night, but it wouldn't work... didn't like the directory or something odd. I moved the sqlite3 program to the C:\ dir and it worked.But now I have no idea where it created the test.db! Haha... Thank you for your help! Clara Trevor Talbot wrote: On

Re: [sqlite] Syntax Error

2006-11-19 Thread Martin Jenkins
Hi Clara, Sometimes confusion arises because SQLite can refer to both a library which implements SQL and a shell which allows command line access to that library. There's a short tutorial on using the shell at http://www.sqlite.org/sqlite.html and several on SQLite's SQL syntax at

Re: [sqlite] Syntax Error

2006-11-19 Thread Trevor Talbot
On 11/18/06, Clara Kinner <[EMAIL PROTECTED]> wrote: I've just started using SQL, and was recommended this program by a co-worker... so I tried the sqlite3 test.db command to start up my new DB, but when I hit enter, it returns with a ...> prompt, so when enter, or end test.db with a ";", I get

[sqlite] Syntax Error

2006-11-18 Thread Clara Kinner
Hello! I am new to the list, and new to SQLite, so hopefully I can get a good start. I've just started using SQL, and was recommended this program by a co-worker... so I tried the sqlite3 test.db command to start up my new DB, but when I hit enter, it returns with a ...> prompt, so when

Re: [sqlite] Syntax Error Loading Values Into Table -- SOLVED!

2006-09-20 Thread Rich Shepard
On Wed, 20 Sep 2006, Rich Shepard wrote: What did I miss here, please? Mea culpa! I specified only one column, not both. Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.(TM)|Accelerator

[sqlite] Syntax Error Loading Values Into Table

2006-09-20 Thread Rich Shepard
I have a table created as: CREATE TABLE hedge (hedge_id integer primary key, hedge_name text); Within the sqlite3 shell I try to load values from the file, 'load-hedges.sql,' and the file has 16 lines of the form: insert into hedge (hedge_name) values ('around'); SQLite complains,

Re: [sqlite] Syntax error near "NOT"

2006-04-05 Thread Pam Greene
What version are you using? The "IF NOT EXISTS" clause only exists in SQLite 3.3.0 and later. - Pam On 4/5/06, Lucky Luke <[EMAIL PROTECTED]> wrote: > > Ok, a VERY VERY strange error, which I can't solve. > > I use the SQLite.NET wrapper from www.phpguru.org to use it with C#. > > I have the

[sqlite] Syntax error near "NOT"

2006-04-05 Thread Lucky Luke
Ok, a VERY VERY strange error, which I can't solve. I use the SQLite.NET wrapper from www.phpguru.org to use it with C#. I have the following query: sql = "CREATE TABLE IF NOT EXISTS bot_users (" + "username VARCHAR(100)," + "password VARCHAR(100) " +

Re: [sqlite] Syntax Error For 3.0.8 --> 3.2.1 Upgrade

2005-04-21 Thread William Hachfeld
On Thu, Apr 21, 2005 at 11:57:19AM -0700, Darren Duncan wrote: > One of your problems is that you are using single quotes for a delimited > identifier, "Open|SpeedShop", when you should be using double quotes. > > Single quotes means a string literal in the SQL standard, where double quotes > a

Re: [sqlite] Syntax Error For 3.0.8 --> 3.2.1 Upgrade

2005-04-21 Thread Darren Duncan
At 12:07 PM -0500 4/21/05, William Hachfeld wrote: sqlite> CREATE TABLE 'Open|SpeedShop' (version INTEGER); sqlite> INSERT INTO 'Open|SpeedShop' (version) VALUES (1); One of your problems is that you are using single quotes for a delimited identifier, "Open|SpeedShop", when you should be using

Re: [sqlite] Syntax Error For 3.0.8 --> 3.2.1 Upgrade

2005-04-21 Thread D. Richard Hipp
On Thu, 2005-04-21 at 12:07 -0500, William Hachfeld wrote: > Heh everyone! > > I've recently tried to upgrade from SQLite 3.0.8 to 3.2.1 and have run into a > snag. This is probably something REAL simple that I'm just not seeing. I'm > hoping someone can point out my stupid mistake... > COLUMN

Re: [sqlite] Syntax Error For 3.0.8 --> 3.2.1 Upgrade

2005-04-21 Thread William Hachfeld
Quite right Thomas and Jolan! I knew it was going to be something stupid on my part. If I change the field "column" to "clumn" it works just fine. Thanks! -- William Hachfeld

Re: [sqlite] Syntax Error For 3.0.8 --> 3.2.1 Upgrade

2005-04-21 Thread Jolan Luff
On Thu, Apr 21, 2005 at 12:07:24PM -0500, William Hachfeld wrote: > I've recently tried to upgrade from SQLite 3.0.8 to 3.2.1 and have run into a > snag. This is probably something REAL simple that I'm just not seeing. I'm > hoping someone can point out my stupid mistake... > > When I rebuild our

RE: [sqlite] Syntax Error For 3.0.8 --> 3.2.1 Upgrade

2005-04-21 Thread Thomas Briggs
:07 PM > To: sqlite-users@sqlite.org > Subject: [sqlite] Syntax Error For 3.0.8 --> 3.2.1 Upgrade > > > Heh everyone! > > I've recently tried to upgrade from SQLite 3.0.8 to 3.2.1 and > have run into a > snag. This is probably something REAL simple that I'm just &g

[sqlite] Syntax Error For 3.0.8 --> 3.2.1 Upgrade

2005-04-21 Thread William Hachfeld
Heh everyone! I've recently tried to upgrade from SQLite 3.0.8 to 3.2.1 and have run into a snag. This is probably something REAL simple that I'm just not seeing. I'm hoping someone can point out my stupid mistake... When I rebuild our project with 3.2.1 instead of 3.0.8, I'm getting a syntax

Re: [sqlite] Syntax error ?

2005-02-24 Thread Richard Nagle
So you must have the PATH set first?, then start the sqlite with a syntax: $sqlite contacts ( this would make a new database called contacts? .database 0 main 1 temp 2 contacts ? Richard Ulrik Petersen <[EMAIL PROTECTED]> wrote: R>ichard Nagle wrote: Sorry, let me get this

Re: [sqlite] Syntax error ?

2005-02-24 Thread Ulrik Petersen
Richard Nagle wrote: Sorry, let me get this straight: WHAT syntax command do I use ? sqlite> Make new database ? sqlite>contacts; The problem there is no Contacts database created ? I would have to make a database first, before creating tables? please explain. You don't make the database

Re: [sqlite] Syntax error ?

2005-02-24 Thread Richard Nagle
Sorry, let me get this straight: WHAT syntax command do I use ? sqlite> Make new database ? sqlite>contacts; The problem there is no Contacts database created ? I would have to make a database first, before creating tables? please explain. Richard Please not using any C or C++ programing (

[sqlite] Syntax error ?

2005-02-23 Thread Richard Nagle
Last login: Thu Feb 24 00:08:34 on ttyp1 Welcome to Darwin! fastmac:~ rn$ /Applications/SQLite/sqlite; exit SQLite version 2.8.13 Enter ".help" for instructions sqlite> .database 0 main 1 temp sqlite> create database contacts; # This is