Re: [sqlite] SQLite Update With CTE

2017-08-22 Thread John McMahon
Thanks Keith On 23/08/2017 00:06, Keith Medcalf wrote: You could also -- if using a version of SQLite3 that supports row values (3.15.0 and later) -- do something like this: SQLite version 3.15.1 2016-11-04 12:08:49, I usually update near the end of year unless I see something particularly

Re: [sqlite] Updating 3 tables based on the ProjID

2017-08-22 Thread jose isaias cabrera
Muchas gracias. -Original Message- From: Simon Slavin Sent: Tuesday, August 22, 2017 6:32 PM To: SQLite mailing list Subject: Re: [sqlite] Updating 3 tables based on the ProjID On 22 Aug 2017, at 11:08pm, jose isaias cabrera wrote: LSOpenProject has the

Re: [sqlite] Updating 3 tables based on the ProjID

2017-08-22 Thread Simon Slavin
On 22 Aug 2017, at 11:08pm, jose isaias cabrera wrote: > LSOpenProject has the same columns as client.LSOpenProjects. The same is > true for LSOpenSubProject and LSOpenJobs. I am just trying to save time with > the inner most SELECT ProjID. I made a mistake. Your

Re: [sqlite] Updating 3 tables based on the ProjID

2017-08-22 Thread jose isaias cabrera
On Tuesday, August 22, 2017 4:47 PM Simon Slavin wrote... On 22 Aug 2017, at 8:45pm, jose isaias cabrera wrote: So, is there a way of combining these three INSERTS into one? You may be able to combine the three SELECTs into one using UNION. I don’t know if it’ll

Re: [sqlite] Updating 3 tables based on the ProjID

2017-08-22 Thread Simon Slavin
On 22 Aug 2017, at 8:45pm, jose isaias cabrera wrote: > So, is there a way of combining these three INSERTS into one? You may be able to combine the three SELECTs into one using UNION. I don’t know if it’ll work if they have different columns. Simon.

[sqlite] Updating 3 tables based on the ProjID

2017-08-22 Thread jose isaias cabrera
Greetings! I have OpenProjects, OpenSubProjects, OpenJobs and each have an unique key called ProjID. I want to update a backup for each based on XtraB != client.LSOpenProjects.XtraB So, is there a way of combining these three INSERTS into one? ATTACH

Re: [sqlite] Compiling spellfix for sqlite3

2017-08-22 Thread Keith Medcalf
On Tuesday, 22 August, 2017 09:30, curmudgeon wrote: >Your cast did the trick Keith and it compiled fine once I removed the >'-DSQLITE_EXTRA_INIT=core_init' line but I have no idea how to get >that directive into the c++ builder application. I've put up a question >on

Re: [sqlite] Compiling spellfix for sqlite3

2017-08-22 Thread curmudgeon
Your cast did the trick Keith and it compiled fine once I removed the '-DSQLITE_EXTRA_INIT=core_init' line but I have no idea how to get that directive into the c++ builder application. I've put up a question on the c++ builder forum but unanswered as yet. -- View this message in context:

Re: [sqlite] SQLite Update With CTE

2017-08-22 Thread Keith Medcalf
You could also -- if using a version of SQLite3 that supports row values (3.15.0 and later) -- do something like this: UPDATE CUSTOMERS SET (cust1, cust2, street, town, postcode) = (SELECT customer, NULL, address, town, postcode FROM test

Re: [sqlite] Comparing rows

2017-08-22 Thread Clemens Ladisch
Matthew Halliday wrote: > Unfortunately is comlains after "SET diff_used," and I get "near ",": > syntax error: " Then your SQLite is too old; row values require 3.15 or later. > it won't diferentiate between servers and drives. Oops! > However this does appear to have worked! Seems a bit

Re: [sqlite] Comparing rows

2017-08-22 Thread Matthew Halliday
However this does appear to have worked! Seems a bit long-winded to me but it worked. I think - going to compare to the same thing in Excel and just check the data before I do a happy-dance. UPDATE tmp_dspace_import SET diff_used = (SELECT tmp_dspace_import.used_mb - ifnull(prev.used_mb, 0)

Re: [sqlite] Comparing rows

2017-08-22 Thread Matthew Halliday
Hi Clemens, thanks for that. Unfortunately is comlains after "SET diff_used," and I get "near ",": syntax error: " If I seperate it out into stand-alone statemeonts like this: UPDATE tmp_dspace_import SET diff_used = (SELECT tmp_dspace_import.used_mb - ifnull(prev.used_mb, 0) FROM

Re: [sqlite] what is server-process-edition?

2017-08-22 Thread Olivier Mascia
> Le 22 août 2017 à 12:05, Gelin Yan a écrit : > > Hi Rowan > > Thanks for your hints. The README also mentions begin-concurrent. Do you > know what it is? > > Regards > > gelin yan The recent post by Richard Hipp to this mailing-list (August, 4th), covers this. Copy

Re: [sqlite] what is server-process-edition?

2017-08-22 Thread Gelin Yan
Hi Rowan Thanks for your hints. The README also mentions begin-concurrent. Do you know what it is? Regards gelin yan ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

Re: [sqlite] Comparing rows

2017-08-22 Thread Clemens Ladisch
Matthew Halliday wrote: > I used the SQLite Studio to create the table so used the DATETIME data type > for that, and although I used -mm-dd hh:mm:ss in the script That is correct. > it seems to have reverted it to dd/mm/yy hh:mm:ss. That would not be usable. Check the actual format with

Re: [sqlite] SQLite Update With CTE

2017-08-22 Thread Clemens Ladisch
John McMahon wrote: > should be > UPDATE CUSTOMERS -- remove 'as c' > SET > cust1= (select customer from test where custnum = CUSTOMERS.custnum), > WHERE custnum IN (SELECT custnum FROM test) Yes. Regards, Clemens ___ sqlite-users mailing

Re: [sqlite] Comparing rows

2017-08-22 Thread Matthew Halliday
Hi Chris, I used SharpDevelop years ago, forgot abot that. I'd like to do it via the script or in-DB because I want a set-and-forget solution I can run on a scheduler. I have stacks of other jobs to do - some actually similar to this, but if I can just leave it to run and generate a daily

Re: [sqlite] Comparing rows

2017-08-22 Thread Chris Locke
> I prefer using the PortableApps SQLite browser for other things as you can have tabbed SQL queries but it doesn't have the DATETIME data type Date and Time *Datatype*. *SQLite* does not have a storage *class* set aside for storing dates and/or times. Instead, the built-in Date And Time

Re: [sqlite] SQLite Update With CTE

2017-08-22 Thread John McMahon
On 22/08/2017 16:41, Clemens Ladisch wrote: John McMahon wrote: UPDATE CUSTOMERS as c SET cust1= (select customer from test where custnum = c.custnum), cust2= NULL, street = (select address from test where custnum = c.custnum), town = (select town from

Re: [sqlite] Comparing rows

2017-08-22 Thread Matthew Halliday
Hi Clemens - thanks for the reply. I'm trying to keep them a regular 4 or 6 hours - I'll see what works best. The script runs as a scheduled task. I used the SQLite Studio to create the table so used the DATETIME data type for that, and although I used -mm-dd hh:mm:ss in the script it

Re: [sqlite] Comparing rows

2017-08-22 Thread Clemens Ladisch
Matthew Halliday wrote: > I have a simple import table: id, servername, drive, capacity, used_mb, > free_mb, free_pc (%) and a date_time field. What is the format of the values in the date_time field? Is there always a constant offset between two consecutive timestamps? Regards, Clemens

[sqlite] Comparing rows

2017-08-22 Thread Matthew Halliday
Good morning all Sorry for the long email. I'm back to using SQLite after some years away from it and from databases in general, so a bit rusty. I'be been trying to figure this out for almost a week now but can't quite get my head around it although I think I understand the principles. My

Re: [sqlite] SQLite Update With CTE

2017-08-22 Thread Clemens Ladisch
John McMahon wrote: > UPDATE CUSTOMERS as c > SET > cust1= (select customer from test where custnum = c.custnum), > cust2= NULL, > street = (select address from test where custnum = c.custnum), > town = (select town from test where custnum = c.custnum), >