Re: [sqlite] sqlite update with joins

2010-05-01 Thread Andreas Henningsson
select. > > This is not possible. > Has someone an idea for a workaround ? > > Simon > > > -Ursprüngliche Nachricht- > Von: Pavel Ivanov > Gesendet: 30.04.2010 21:38:54 > An: General Discussion of SQLite Database > Betreff: Re: [sqlite] sqlite update with

Re: [sqlite] sqlite update with joins

2010-05-01 Thread wdlurd
update with joins You could try UPDATE H SET filename = (select F.rowid from F where F.filename = H.filename); Pavel On Fri, Apr 30, 2010 at 3:25 PM, David Lyon wrote: > I know sqlite update with joins is not supported but I have heard work > arounds without the need for scripting. >

Re: [sqlite] sqlite update with joins

2010-04-30 Thread David Lyon
That works... Thank you very much. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] sqlite update with joins

2010-04-30 Thread Pavel Ivanov
You could try UPDATE H SET filename = (select F.rowid from F where F.filename = H.filename); Pavel On Fri, Apr 30, 2010 at 3:25 PM, David Lyon wrote: > I know sqlite update with joins is not supported but I have heard work > arounds without the need for scripting. > > eg: > 2

Re: [sqlite] sqlite update with joins

2010-04-30 Thread Igor Tandetnik
David Lyon wrote: > I know sqlite update with joins is not supported but I have heard > work arounds without the need for scripting. > > eg: > 2 tables H and F both join on FILENAME > I want to update h.FILENAME so its the same as the rowid of table F > > > sqlit

[sqlite] sqlite update with joins

2010-04-30 Thread David Lyon
I know sqlite update with joins is not supported but I have heard work arounds without the need for scripting. eg: 2 tables H and F both join on FILENAME I want to update h.FILENAME so its the same as the rowid of table F sqlite3 F "update H h , F f set h.FILENAME=f.rowid where h.FIL

Re: [sqlite] Update problem in use C/C++ interface

2010-03-26 Thread Pavel Ivanov
> and i'm sure there is a record with the ID bind for the third parameter. You should be also sure that this record contains ID as an integer value, not as text value. Without affinity integer will never be equal to text. Pavel 2010/3/24 王志刚 : > ??? wrote: >> Hi, I meet a problem in use c/c++ A

Re: [sqlite] Update problem in use C/C++ interface

2010-03-24 Thread 王志刚
??? wrote: > Hi, I meet a problem in use c/c++ API to update a row in table. > all return value means the operate is successful, But the row have no > change at all. How do you determine this? > the main code al follow: > >wstring sql = L"UPDATE Mail SET [Content] = ?1 [CurrentSize] = ?2 > WH

Re: [sqlite] Update problem in use C/C++ interface

2010-03-24 Thread Igor Tandetnik
王志刚 wrote: > Hi, I meet a problem in use c/c++ API to update a row in table. > all return value means the operate is successful, But the row have no > change at all. How do you determine this? > the main code al follow: > >wstring sql = L"UPDATE Mail SET [Content] = ?1 [CurrentSize] = ?2 > W

[sqlite] Update problem in use C/C++ interface

2010-03-24 Thread 王志刚
Hi, I meet a problem in use c/c++ API to update a row in table. all return value means the operate is successful, But the row have no change at all. and the INSERT , SELECT operation is OK. I think maybe I'm not first one meet this problem.But I can't visit the archive. So if anyone here know abou

Re: [sqlite] UPDATE

2010-03-02 Thread Simon Davies
On 2 March 2010 11:31, Matt Eeles wrote: > Hi, > > > > I'm trying to update a field of the last record using UPDATE and MAX(). > The following query parses ok but updates all records.  Any reason why ? > > > > UPDATE logs SET Stop = DATETIME('NOW') WHERE (SELECT MAX(ID) FROM logs) (SELECT MAX(ID)

Re: [sqlite] UPDATE

2010-03-02 Thread Simon Slavin
On 2 Mar 2010, at 11:31am, Matt Eeles wrote: > I'm trying to update a field of the last record using UPDATE and MAX(). > The following query parses ok but updates all records. Any reason why ? > > > > UPDATE logs SET Stop = DATETIME('NOW') WHERE (SELECT MAX(ID) FROM logs) Your WHERE clause t

[sqlite] UPDATE

2010-03-02 Thread Matt Eeles
Hi, I'm trying to update a field of the last record using UPDATE and MAX(). The following query parses ok but updates all records. Any reason why ? UPDATE logs SET Stop = DATETIME('NOW') WHERE (SELECT MAX(ID) FROM logs) Thanks, Matt. _

Re: [sqlite] Update/Delete problem

2010-02-02 Thread Kees Nuyt
On Tue, 2 Feb 2010 09:20:29 +0100, Carsten Peyk wrote: >Hi, > > I have tried closing and opening the applications, > but the problem is still there. I have tried to > commit the changes for SQLLite Database Browser, > but SQLLite is responding with the message "No > active transactions". I'm sur

Re: [sqlite] Update/Delete problem

2010-02-02 Thread Pavel Ivanov
ndelig meddelelse- > Fra: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] > På vegne af Pavel Ivanov > Sendt: 1. februar 2010 19:01 > Til: General Discussion of SQLite Database > Emne: Re: [sqlite] Update/Delete problem > > Are you sure that Spiceworks

Re: [sqlite] Update/Delete problem

2010-02-02 Thread Carsten Peyk
sqlite.org [mailto:sqlite-users-boun...@sqlite.org] På vegne af Pavel Ivanov Sendt: 1. februar 2010 19:01 Til: General Discussion of SQLite Database Emne: Re: [sqlite] Update/Delete problem Are you sure that Spiceworks or SQLLite Database Browser commit your changes? What happens if you close those

Re: [sqlite] Update/Delete problem

2010-02-01 Thread Pavel Ivanov
Are you sure that Spiceworks or SQLLite Database Browser commit your changes? What happens if you close those applications and restart it - will they see their own changes? If they will and they still won't see other application's changes then you can be sure that you're looking at different databa

[sqlite] Update/Delete problem

2010-02-01 Thread Carsten Peyk
Hi, I'm completely new to SQLLite, and I'm very sorry if I ask a trivial question. I'm using Spiceworks which again uses SQLLite as backend database. I've made some updates and deletions to the records using the freeware SQLLite Database Browser application. If I the open Spiceworks application

Re: [sqlite] update on Ticket 3437

2010-01-24 Thread ve3meo
You're right! I arrived at a failure of a different kind because I did not drop the Races table as per his script between adding the first record with ID='20' and the second with ID=20. If Races table contains two records, the first with ID='20' and the second with ID=20, his query fails, even t

Re: [sqlite] update on Ticket 3437

2010-01-24 Thread Jean-Christophe Deschamps
>No, it fails because 20 != '20' And also possibly because Date LIKE "2009%" should be Date LIKE '2009%' everywhere it appears. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlit

Re: [sqlite] update on Ticket 3437

2010-01-24 Thread Igor Tandetnik
Tom Holden wrote: > Nick, I think your query fails because there is a potential for multiple > values on the right-hand side of WHERE RaceID=. No, it fails because 20 != '20' Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://s

Re: [sqlite] update on Ticket 3437

2010-01-24 Thread Tom Holden
ery be better composed as: SELECT * from races, times WHERE RACEID = ID and Races.Name = 'totley moor' AND Date LIKE "2009%"; Tom - Original Message - From: To: Sent: Saturday, January 23, 2010 7:59 PM Subject: [sqlite] update on Ticket 3437 > Hi, > I submitte

[sqlite] update on Ticket 3437

2010-01-24 Thread nick
Hi, I submitted this some time ago, see http://www.sqlite.org/cvstrac/tktview?tn=3437,39. I've just been messing about with this again and have found out what was happening. The following script demonstrates the problem and resolution: [begin bug2.sql] /* this command line will demonstrate

Re: [sqlite] UPDATE the order of INT fileds

2009-12-22 Thread Simon Slavin
On 22 Dec 2009, at 11:48am, Andrea Galeazzi wrote: > Probably it won't work because ID must be UNIQUE and Name is not. Ah. Okay, pick an arbitrary number, perhaps 999, to use temporarily for the entry that's being moved. Simon. ___ sqlite-users mail

Re: [sqlite] UPDATE the order of INT fileds

2009-12-22 Thread Andrea Galeazzi
Simon Slavin ha scritto: > On 22 Dec 2009, at 10:25am, Andrea Galeazzi wrote: > > >> ID INTEGER, >> Name TEXT >> >> So, for instance, I can have: >> >> 1 Julia >> 2 Eric >> 3 Kevin >> 4 Sarah >> 5 John >> >> Now I wanna move Eric from 2 to 4 in order to yield (by performing a >> series of UPDAT

Re: [sqlite] UPDATE the order of INT fileds

2009-12-22 Thread Simon Slavin
On 22 Dec 2009, at 10:25am, Andrea Galeazzi wrote: > ID INTEGER, > Name TEXT > > So, for instance, I can have: > > 1 Julia > 2 Eric > 3 Kevin > 4 Sarah > 5 John > > Now I wanna move Eric from 2 to 4 in order to yield (by performing a > series of UPDATE of ID field): > > 1 Julia > 2 Kevin > 3

[sqlite] UPDATE the order of INT fileds

2009-12-22 Thread Andrea Galeazzi
Hi, I'm trying to solve this problem: I've got the following table, made up of two fields: ID INTEGER, Name TEXT So, for instance, I can have: 1 Julia 2 Eric 3 Kevin 4 Sarah 5 John Now I wanna move Eric from 2 to 4 in order to yield (by performing a series of UPDATE of ID field): 1 Julia

Re: [sqlite] UPDATE problem.

2009-11-22 Thread Igor Tandetnik
lilezek wrote: > Hi. I'm using SQLite in my own c++ aplication. Everything works except if I > try to do this query: > > UPDATE rnc_accounts SET lastip = '127.0.0.1' WHERE name = 'lilezek'; > > But when I do step I got always 5 (SQLITE_BUSY). You'll think the problem is > mine, but I change the

[sqlite] UPDATE problem.

2009-11-22 Thread lilezek
Hi. I'm using SQLite in my own c++ aplication. Everything works except if I try to do this query: UPDATE rnc_accounts SET lastip = '127.0.0.1' WHERE name = 'lilezek'; But when I do step I got always 5 (SQLITE_BUSY). You'll think the problem is mine, but I change the query to the next one: SELE

Re: [sqlite] "UPDATE FROM"

2009-10-06 Thread Pavel Ivanov
> Is there somewhere that it is explained how to do this in SQLITE? There's no way for this in SQLite. You have to rewrite your update statement to be for example like UPDATE ... WHERE id IN (SELECT ... ) > I want to add a column to T1 for the appropriate sex for a given ID from T2. Sorry, I cou

[sqlite] "UPDATE FROM"

2009-10-06 Thread ws
In Postgresql, there is a (nonstandard) way to specify multiple tables in an update clause, useful when updating a table with columns based on an inner join idea. Is there somewhere that it is explained how to do this in SQLITE? Example Table 1 has ID, age Table 2 has ID, sex I want to add a

Re: [sqlite] Update vs Insert

2009-09-22 Thread Jay A. Kreibich
On Tue, Sep 22, 2009 at 11:31:16AM -0500, logan.rat...@emerson.com scratched on the wall: > > I am having problems with the update command (through the interface > > library). In most databases if you issue an update to a record that > > does not exist, it simply adds a new record. When I try t

Re: [sqlite] Update vs Insert

2009-09-22 Thread Simon Slavin
cord that does not > exist, it simply adds a new record. When I try this in SQLite I get > an error back. > > Is the SQLite update restricted to a record you know already exists? Not sure what you mean. In SQL the UPDATE command has an optional WHERE clause that specifies whic

Re: [sqlite] Update vs Insert

2009-09-22 Thread Logan.Ratner
>You can't do that with an 'update' but you can with 'insert or replace.' >This is true in any SQL driven database, not just SQL. (Er, that should read 'not just SQLite.') Logan Ratner | Software Engineer | Gas Chromatographs Emerson Process Management | 5650 Brittmoore Rd | Houston | TX | 77041

Re: [sqlite] Update vs Insert

2009-09-22 Thread Logan.Ratner
>From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users->boun...@sqlite.org] On Behalf Of Barton Torbert >Sent: Tuesday, September 22, 2009 11:07 AM >To: General Discussion of SQLite Database >Subject: [sqlite] Update vs Insert > >Hello, > >I am having problems with

Re: [sqlite] Update vs Insert

2009-09-22 Thread Igor Tandetnik
Barton Torbert wrote: > I am having problems with the update command (through the interface > library). In most databases if you issue an update to a record that > does not exist, it simply adds a new record. No database I've ever heard of does that. It must be a feature of the library you are

[sqlite] Update vs Insert

2009-09-22 Thread Barton Torbert
Hello, I am having problems with the update command (through the interface library). In most databases if you issue an update to a record that does not exist, it simply adds a new record. When I try this in SQLite I get an error back. Is the SQLite update restricted to a record you know

Re: [sqlite] UPDATE with JOIN fails

2009-09-15 Thread Nightfox79
Amazing!! That worked! Thanks Igor! -- View this message in context: http://www.nabble.com/UPDATE-with-JOIN-fails-tp25458099p25460200.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org h

Re: [sqlite] UPDATE with JOIN fails

2009-09-15 Thread Igor Tandetnik
Nightfox79 wrote: > I'm trying to update one table based on information in an other. I > have two tables, transactions (trans) and accounts (account). I want > to update the debit amount in the transaction table (trans) with vat > information from the accounts table (account) for a particular > ac

[sqlite] UPDATE with JOIN fails

2009-09-15 Thread Nightfox79
I'm trying to update one table based on information in an other. I have two tables, transactions (trans) and accounts (account). I want to update the debit amount in the transaction table (trans) with vat information from the accounts table (account) for a particular account. Normally (ie. in othe

Re: [sqlite] update - select

2009-09-01 Thread Pavel Ivanov
It will work but remember that you have to mention in INSERT all fields that you want to have non-default and non-null values. So if you want just to update a couple of fields and leave as is all others then you'll need to do something like this: INSERT OR REPLACE INTO Customers (SSN, Street, Hous

Re: [sqlite] update - select

2009-09-01 Thread Gerald Ebner
thanks for the quick response! we typically have 3 unique keys on every table: - on the ID used for foreign keys - on the global unique ID used for synchronization - and on 2..3 fields that must be unique according to the problem domain (e.g. name + surname + birth date) will INSERT OR REPLACE al

Re: [sqlite] update - select

2009-09-01 Thread Pavel Ivanov
If you have unique index on Customers.SSN in you database then you can do it in SQLite like this: INSERT OR REPLACE INTO Customers (SSN, Street, HouseNo, City) SELECT SSN, Street, HouseNo, City FROM Moved; Pavel On Tue, Sep 1, 2009 at 2:54 PM, Gerald Ebner wrote: > hm, finally I'm looking for a

Re: [sqlite] update - select

2009-09-01 Thread Gerald Ebner
hm, finally I'm looking for a convenient way to execute update-selects, very helpful in doing synchronization between different databases is there in SQLite any other way? e.g.: there is a SQL-server-proprietary UPDATE FROM syntax, e.g.: UPDATE c SET Street = m.Street, HouseNo = m.HouseNo,

Re: [sqlite] update - select

2009-09-01 Thread Igor Tandetnik
Gerald Ebner wrote: > the given syntax is ANSI sql ("row-value constructors"), > see also the discussion at > http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx > > Is it likely that row-value constructors will be implemented in the > (near) future ? I was c

Re: [sqlite] update - select

2009-09-01 Thread Gerald Ebner
the given syntax is ANSI sql ("row-value constructors"), see also the discussion at http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx Is it likely that row-value constructors will be implemented in the (near) future ? Jonas Sandman wrote: > On Thu, Aug 20

Re: [sqlite] update - select

2009-08-20 Thread Pavel Ivanov
If you have synonym for rowid (i.e. column INTEGER PRIMARY KEY) or some other unique columns combination then you can do something like this: INSERT OR REPLACE INTO table_1 (rowid, field_a, field_b, field_c, field_d) SELECT table_1.rowid, table_2.field_a, table_2.field_b, table_2.field_c, ta

Re: [sqlite] update - select

2009-08-20 Thread Jonas Sandman
On Thu, Aug 20, 2009 at 12:01 PM, Gerald Ebner wrote: > Dear all, > > it seems that sqlite does not allow update statements of this kind: > > UPDATE table_1 SET (field_a, field_b, field_c, field_d) = ( >    SELECT field_a, field_b, field_c, field_d FROM table_2 WHERE … > ) > WHERE > Is this r

[sqlite] update - select

2009-08-20 Thread Gerald Ebner
Dear all, it seems that sqlite does not allow update statements of this kind: UPDATE table_1 SET (field_a, field_b, field_c, field_d) = ( SELECT field_a, field_b, field_c, field_d FROM table_2 WHERE … ) WHERE I succeeded only with UPDATE table_1 SET field_a = (SELECT field_a FROM ta

Re: [sqlite] UPDATE 11 times slower than SELECT?

2009-08-12 Thread Nikolaus Rath
Roger Binns writes: > Nikolaus Rath wrote: >> Is it normal that UPDATE still takes more than 11 times as much time as >> SELECT, or should I be able to get better performance? > > The UPDATE time also includes the time waiting to acquire file locks. If > you have concurrent activity it could take

Re: [sqlite] UPDATE 11 times slower than SELECT?

2009-08-11 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nikolaus Rath wrote: > Is it normal that UPDATE still takes more than 11 times as much time as > SELECT, or should I be able to get better performance? The UPDATE time also includes the time waiting to acquire file locks. If you have concurrent activ

Re: [sqlite] UPDATE 11 times slower than SELECT?

2009-08-11 Thread Nikolaus Rath
"Igor Tandetnik" writes: > Nikolaus Rath wrote: >> When running apswtrace on my Python program, I got the following >> output: >> >> LONGEST RUNNING - AGGREGATE >> >> 16638 11.041 UPDATE inodes SET size=MAX(size,?), ctime=?, mtime=? >> WHERE id=? 16638 0.938 SELECT s3key FROM inode_s3key WHERE

Re: [sqlite] UPDATE 11 times slower than SELECT?

2009-08-11 Thread Igor Tandetnik
Nikolaus Rath wrote: > When running apswtrace on my Python program, I got the following > output: > > LONGEST RUNNING - AGGREGATE > > 16638 11.041 UPDATE inodes SET size=MAX(size,?), ctime=?, mtime=? > WHERE id=? 16638 0.938 SELECT s3key FROM inode_s3key WHERE inode=? > AND offset=? > > i.e. bot

[sqlite] UPDATE 11 times slower than SELECT?

2009-08-11 Thread Nikolaus Rath
Hi, When running apswtrace on my Python program, I got the following output: LONGEST RUNNING - AGGREGATE 16638 11.041 UPDATE inodes SET size=MAX(size,?), ctime=?, mtime=? WHERE id=? 16638 0.938 SELECT s3key FROM inode_s3key WHERE inode=? AND offset=? i.e. both statements were executed 1663

Re: [sqlite] UPDATE with inline view/ derived table

2009-06-11 Thread Kees Nuyt
On Thu, 11 Jun 2009 20:17:59 +0200, Frank Naude wrote: >Hi, > >I need some help getting this UPDATE to work with sqlite 3.3.8: > >UPDATE fud28_read >SET user_id=2, msg_id=t.last_post_id, last_view=1244710953 >FROM (SELECT id, last_post_id FROM fud28_thread WHERE forum_id=4 AND >last_post_date > 0

Re: [sqlite] UPDATE with inline view/ derived table

2009-06-11 Thread Frank Naude
Hi Pavel, On Thu, Jun 11, 2009 at 8:28 PM, Pavel Ivanov wrote: > According to this http://www.sqlite.org/lang_update.html you have > invalid syntax. > I believe you can achieve the same by this (assuming that id is unique > in fud28_thread): > > UPDATE fud28_read > SET user_id=2, last_view=1244710

Re: [sqlite] UPDATE with inline view/ derived table

2009-06-11 Thread Pavel Ivanov
According to this http://www.sqlite.org/lang_update.html you have invalid syntax. I believe you can achieve the same by this (assuming that id is unique in fud28_thread): UPDATE fud28_read SET user_id=2, last_view=1244710953, msg_id=(SELECT last_post_id FROM fud28_thread

[sqlite] UPDATE with inline view/ derived table

2009-06-11 Thread Frank Naude
Hi, I need some help getting this UPDATE to work with sqlite 3.3.8: UPDATE fud28_read SET user_id=2, msg_id=t.last_post_id, last_view=1244710953 FROM (SELECT id, last_post_id FROM fud28_thread WHERE forum_id=4 AND last_post_date > 0) t WHERE user_id=2 AND thread_id=t.id Error: near "FROM" - synt

[sqlite] UPDATE while SELECT is active

2009-06-02 Thread Nikolaus Rath
Hello, I am pretty sure that at some point I have read if the following code might bring me into trouble: cur1 = conn.get_cursor() cur2 = conn.get_cursor() res = cur1.execute("SELECT id FROM data WHERE enabled == 1") for name in res: cur2.execute("UPDATE data SET enabled = 0 WHERE id=?", nam

Re: [sqlite] UPDATE TRIGGER works in all records

2009-06-02 Thread Oliver Peters
Am Montag, den 01.06.2009, 07:38 -0400 schrieb Igor Tandetnik: > Oliver Peters wrote: > > After an UPDATE in a record I want the update time stored in a column > > of this record - the problem is that the trigger I use doesn't work > > only in this record but in all others > > > > CREATE TRIGGER IF

Re: [sqlite] UPDATE TRIGGER works in all records

2009-06-01 Thread Igor Tandetnik
Oliver Peters wrote: > After an UPDATE in a record I want the update time stored in a column > of this record - the problem is that the trigger I use doesn't work > only in this record but in all others > > CREATE TRIGGER IF NOT EXISTS t_update_a > AFTER UPDATE ON t > BEGIN > UPDATE t SET b

Re: [sqlite] UPDATE TRIGGER works in all records

2009-06-01 Thread Pavel Ivanov
Your trigger basically does this: UPDATE t SET b = DATETIME('now','localtime') WHERE 1 != 0; So it updates all rows in the table. Try to change it to this: UPDATE t SET b = DATETIME('now','localtime') WHERE rowid = new.rowid; Pavel On Sun, May 31, 2009 at 7:44 AM, Oliver Peters wrote: > Afte

[sqlite] UPDATE TRIGGER works in all records

2009-06-01 Thread Oliver Peters
After an UPDATE in a record I want the update time stored in a column of this record - the problem is that the trigger I use doesn't work only in this record but in all others Here's my script for reproduction: - CREATE TABLE IF NOT EXISTS t( a TEXT

Re: [sqlite] Update query along with limit option

2009-04-19 Thread thirunavukarasu selvam
Thanks for ur equivalent query. Its working as expected using rowid will not be prob rightAs long as its value is unique. Regards, Thiru. On Sun, Apr 19, 2009 at 8:33 PM, Igor Tandetnik wrote: > "thirunavukarasu selvam" > wrote in message > news:5b5250670904190006h7faba51ejbd9c392c0584c

Re: [sqlite] Update query along with limit option

2009-04-19 Thread thirunavukarasu selvam
status is basically used for display Always new row is added with status 0 Once its been displayed the status has to be changed to 1. Its just to track of rows displayed and new added rows. On Sun, Apr 19, 2009 at 12:51 PM, John Machin wrote: > On 19/04/2009 5:06 PM, thirunavukarasu selvam wrote:

Re: [sqlite] Update query along with limit option

2009-04-19 Thread Igor Tandetnik
"thirunavukarasu selvam" wrote in message news:5b5250670904190006h7faba51ejbd9c392c0584c...@mail.gmail.com > I need a help in using update query along with limit option. > I tried the following query > update table-name SET status='1' where status='0' limit 2 > status - column name. You could use

Re: [sqlite] Update query along with limit option

2009-04-19 Thread John Machin
On 19/04/2009 5:06 PM, thirunavukarasu selvam wrote: > I tried the following query > update table-name SET status='1' where status='0' limit 2 > status - column name. What is "status - column name" meant to do? > I am using sqlite-amalgamation-3.6.13.tar.gz source from sqlite.org. > > I configur

[sqlite] Update query along with limit option

2009-04-19 Thread thirunavukarasu selvam
Hello all, Am new to sqlite. I need a help in using update query along with limit option. I tried the following query update table-name SET status='1' where status='0' limit 2 status - column name. I need to update the value of status columns having value 0 to value 1. That too for only 2 records/

Re: [sqlite] UPDATE Field based on matching value in different Table

2009-02-25 Thread Greg Robertson
, 23 Feb 2009 20:35:41 -0500 From: "Igor Tandetnik" Subject: Re: [sqlite] UPDATE Field based on matching value in different Table To: sqlite-users@sqlite.org Message-ID: "Greg Robertson" wrote in message news:151e70a00902231728j608612b8n491e84b11c70c...@mail.gma

Re: [sqlite] UPDATE Field based on matching value in different Table

2009-02-23 Thread Igor Tandetnik
"Greg Robertson" wrote in message news:151e70a00902231728j608612b8n491e84b11c70c...@mail.gmail.com > That did it. > > Thanks > > Greg > > On Mon, Feb 23, 2009 at 7:05 PM, Griggs, Donald > wrote: >> Hi Greg, >> >> Someone on the list may give a better reply, and I'm sending this to >> you >> direc

Re: [sqlite] UPDATE Field based on matching value in different Table

2009-02-23 Thread Greg Robertson
ld4 from tableB >where TableA.Field3=TableB.Field4 ); > > Regards, > Donald > > -Original Message- > From: sqlite-users-boun...@sqlite.org > [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Greg Robertson > Sent: Monday, February 23, 2009 6:34 PM > To:

Re: [sqlite] UPDATE Field based on matching value in different Table

2009-02-23 Thread Igor Tandetnik
"Greg Robertson" wrote in message news:151e70a00902231534h37d10202m469a176d704d6...@mail.gmail.com > I have two tables each with two fields: > > TableA: Field1, Field2 > > TableB: Field3, Field4 > > > I would like to set Field2 in TableA to the value in Field4 in TableB > where TableA.Field3=Table

Re: [sqlite] UPDATE Field based on matching value in different Table

2009-02-23 Thread P Kishor
On Mon, Feb 23, 2009 at 5:34 PM, Greg Robertson wrote: > I have two tables each with two fields: > > TableA: Field1, Field2 > > TableB: Field3, Field4 > > > I would like to set Field2 in TableA to the value in Field4 in TableB > where TableA.Field3=TableB.Field4 > > Sounds simple enough but I can'

Re: [sqlite] UPDATE Field based on matching value in different Table

2009-02-23 Thread Clark Christensen
e.org Sent: Monday, February 23, 2009 3:34:15 PM Subject: [sqlite] UPDATE Field based on matching value in different Table I have two tables each with two fields: TableA: Field1, Field2 TableB: Field3, Field4 I would like to set Field2 in TableA to the value in Field4 in TableB where Tab

[sqlite] UPDATE Field based on matching value in different Table

2009-02-23 Thread Greg Robertson
I have two tables each with two fields: TableA: Field1, Field2 TableB: Field3, Field4 I would like to set Field2 in TableA to the value in Field4 in TableB where TableA.Field3=TableB.Field4 Sounds simple enough but I can't figure out how to write the UPDATE SQLite for this. Can someone help?

Re: [sqlite] 'UPDATE shop_orders SET comments=comments||? WHERE oid=?', ('test', '1')

2009-01-22 Thread Gert Cuykens
thanks On Tue, Jan 20, 2009 at 5:54 PM, Hoover, Jeffrey wrote: > if comments is null then comments||? is also null, try this: > > comments=coalesce(comments,'')||? > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/ma

Re: [sqlite] 'UPDATE shop_orders SET comments=comments||? WHERE oid=?', ('test', '1')

2009-01-20 Thread Hoover, Jeffrey
sqlite.org Subject: [sqlite] 'UPDATE shop_orders SET comments=comments||? WHERE oid=?',('test', '1') How do i do the following ? comments=comments||? When I add a comment nothing happens ? (please reply to my email address no subscription)

Re: [sqlite] 'UPDATE shop_orders SET comments=comments||? WHERE oid=?', ('test', '1')

2009-01-19 Thread Igor Tandetnik
"Gert Cuykens" wrote in message news:ef60af090901180715s58fdc033p2c4ba7df6fb90...@mail.gmail.com > How do i do the following ? > > comments=comments||? > > When I add a comment nothing happens ? What's in comments field before the update? Is it NULL, by any chance? NULL || 'anything' = NULL. Al

[sqlite] 'UPDATE shop_orders SET comments=comments||? WHERE oid=?', ('test', '1')

2009-01-19 Thread Gert Cuykens
How do i do the following ? comments=comments||? When I add a comment nothing happens ? (please reply to my email address no subscription) ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-user

Re: [sqlite] Update if exists or Insert if exists

2009-01-09 Thread Jim Dodgen
"insert or replace" should do it On Fri, Jan 9, 2009 at 6:21 PM, chiefmccrossan wrote: > > Hi, > > I have a table called Test with one column called Name - CREATE TABLE > "Test" > ("Name" VARCHAR) > > I would like to insert a value into test if the name column is empty but if > the column is not

[sqlite] Update if exists or Insert if exists

2009-01-09 Thread chiefmccrossan
Hi, I have a table called Test with one column called Name - CREATE TABLE "Test" ("Name" VARCHAR) I would like to insert a value into test if the name column is empty but if the column is not empty then I would like to update/overwrite the current value in the Name column. Can anyone please hel

Re: [sqlite] update PHP

2009-01-09 Thread Emil Obermayr
Am Donnerstag, 8. Januar 2009 schrieb Kees Nuyt: > Note: With Apache, the easiest location for sqlite3.dll is > the .../apache/bin directory. php_pdo will find it there. > Perhaps the same goes for lighttpd. It works with sqlite3.dll in die PHP-directory. Thanks for that information. Everything

Re: [sqlite] update PHP

2009-01-08 Thread Kees Nuyt
On Thu, 8 Jan 2009 15:29:33 +0100, n...@nobswolf.info (Emil Obermayr) wrote in General Discussion of SQLite Database : >Hello list, > >I run a Windows XP system and want to "fill" the sqlite-DB through a >ODBC-connection with data from other databases and then use it on a >independant server (ligh

[sqlite] update PHP

2009-01-08 Thread Emil Obermayr
Hello list, I run a Windows XP system and want to "fill" the sqlite-DB through a ODBC-connection with data from other databases and then use it on a independant server (lighttp on USB-stick). The sqlite-version I get as ODBC-driver works nicely. The sqlite-version I get included in PHP as well.

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'; >> >>

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

2008-12-22 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'; >> >>

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

2008-12-22 Thread Igor Tandetnik
"jose isaias cabrera" wrote in message news:5c0942b2619c4403b47ddf72586c8...@stso.mc.xerox.com > 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.i

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

2008-12-22 Thread jose isaias cabrera
Greetings! imagine this situation... CREATE TABLE foo (id, PID, bdate, edate, lang,job); INSERT INTO foo VALUES (1, 232,'2008-01-01','2008-01-10','es','trans'); INSERT INTO foo VALUES (2, 232,'2008-01-01','2008-01-10','fr','trans'); INSERT INTO foo VALUES (3, 232,'2008-01-01','2008-01-10','it','

Re: [sqlite] UPDATE - to simplify the code...

2008-12-04 Thread Igor Tandetnik
"Ernany" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Is it possible to simplify the code? I have ten fields to UPDATE. >> (STATUS, Responsavel, Country,..) >> >> UPDATE Bens SET *STATUS *= >> CASE (SELECT COUNT(BENSBK.STATUS) FROM BENSBK WHERE BENSBK.BEM = >> Bens.BEM) >> W

Re: [sqlite] UPDATE - to simplify the code...

2008-12-04 Thread Ernany
Hello Igor, > Is it possible to simplify the code? I have ten fields to UPDATE. > (STATUS, Responsavel, Country,..) > > UPDATE Bens SET *STATUS *= > CASE (SELECT COUNT(BENSBK.STATUS) FROM BENSBK WHERE BENSBK.BEM = > Bens.BEM) > WHEN 0 THEN Bens.STATUS > ELSE (SELECT BENSBK.STATUS FROM BENSB

Re: [sqlite] UPDATE - to simplify the code...

2008-11-13 Thread Igor Tandetnik
"Ernany" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is it possible to simplify the code? I have ten fields to UPDATE. > (STATUS, Responsavel, Country,..) > > UPDATE Bens SET *STATUS *= > CASE (SELECT COUNT(BENSBK.STATUS) FROM BENSBK WHERE BENSBK.BEM = > Bens.BEM) > WHEN 0 T

[sqlite] UPDATE - to simplify the code...

2008-11-13 Thread Ernany
Hello , Is it possible to simplify the code? I have ten fields to UPDATE. (STATUS, Responsavel, Country,..) Thanks, Ernany ** UPDATE Bens SET *STATUS *= CASE (SELECT COUNT(B

[sqlite] Update is it correct???

2008-11-12 Thread Ernany
UPDATE??? table : PROD table: NewPROD codigo descriçao qtde codigo descriçao qtde 1 banana 10 3 nada 10 2 abacaxi 20 4 tudo 20 3 nada 30 5 cinco 30 4 tudo dwww 5 cinco 50 6 seis 60 7 sete 70 8 oito 80 UPDATE PROD SET qtde = (S

Re: [sqlite] Update question

2008-10-22 Thread Igor Tandetnik
Jon Dixon <[EMAIL PROTECTED]> wrote: > I am updating how I handle dates/durations in a database of mine and > I would like to come up with an SQL command to make the change for > me. > > The old format had a field Departure (-MM-DD) and a field Nights > (an integer), where the new format > stil

Re: [sqlite] Update question

2008-10-22 Thread Brad Stiles
> My stab at an SQL statement to pull this change off is as follows: > UPDATE > Events SET Return = date(d, n + ' days') WHERE pkIndex IN (SELECT > pkIndex, Nights AS n, Departure AS d FROM Events WHERE Return = '' AND Nights > != '') Why do you think you need the sub-select? Assuming that they

[sqlite] Update question

2008-10-22 Thread Jon Dixon
Hello all, I am updating how I handle dates/durations in a database of mine and I would like to come up with an SQL command to make the change for me. The old format had a field Departure (-MM-DD) and a field Nights (an integer), where the new format still uses Departure but adds Return (YY

Re: [sqlite] UPDATE statement with several tables

2008-10-20 Thread Kees Nuyt
re) at once. > >But in this purpose, we encounter a severe issue in the fact that in >Sqlite, UPDATE statements, in the contrary of INSERT statements, >doesn't compute several tables at once. > >On this mailing list, Igor Tandetnik (thank's Igor) showed us a >workar

Re: [sqlite] UPDATE statement with several tables

2008-10-20 Thread Dan
INSERT/UPDATE statements executed against the db, and > subsets are calculated with INNER JOINS between the tables inside each > statement. > In consequence, our statements are easily dealing with 3/4 tables (not > rarely more) at once. > > But in this purpose, we encounter a severe

[sqlite] UPDATE statement with several tables

2008-10-20 Thread jm cuaz
JOINS between the tables inside each statement. In consequence, our statements are easily dealing with 3/4 tables (not rarely more) at once. But in this purpose, we encounter a severe issue in the fact that in Sqlite, UPDATE statements, in the contrary of INSERT statements, doesn't co

Re: [sqlite] Update command working from command line but not from a C program

2008-09-16 Thread Simon Davies
2008/9/16 Aravinda babu <[EMAIL PROTECTED]>: > Hi all, > . . . > static const char *updateCmd = "UPDATE cert_store_table set lastRowFlag = > :lastRowFlag where lastRowFlag = :lastRowFlag;" ; > < same named parameter twice > . . . > Is there any

<    1   2   3   4   5   6   7   8   >