[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 probl

Re: [sqlite] Comparing rows

2017-08-22 Thread Matthew Halliday
, that seems to work ok. I have mailing list emails going back a few years to when I used to use SQLite a lot but couldn't find anything in them for this. On Tue, Aug 22, 2017 at 9:20 AM, Clemens Ladisch wrote: > Matthew Halliday wrote: > > I have a simple import table: id, servernam

Re: [sqlite] Comparing rows

2017-08-22 Thread Matthew Halliday
hat you want could be > accomplished with 'naked' SQLite, but a proper 'script' (or application) > would give you much more control, reporting, etc, etc. > > PS: DB4S is on v3.10 now, so if you're using the 'portable version', it > needs updating! ;) &g

Re: [sqlite] Comparing rows

2017-08-22 Thread Matthew Halliday
ything. Not sure if the abokve is ok - looks ok to me. The only question in my mind is that it won't diferentiate between servers and drives.SOme only have a C drive but most hace a D and E, some have an F. All local drives btw, not mapped. On Tue, Aug 22, 2017 at 10:32 AM, Clemens Ladisch wro

Re: [sqlite] Comparing rows

2017-08-22 Thread Matthew Halliday
S prev WHERE tmp_dspace_import.servername = prev.servername AND tmp_dspace_import.drive = prev.drive AND prev.date_time < tmp_dspace_import.date_time ORDER BY date_time DESC LIMIT 1); On Tue, Aug 22, 2017 at 11:35 AM, Matthew Halliday wrote: > Hi Clemens, thanks for that. > >

[sqlite] Date time functions not working

2017-08-24 Thread Matthew Halliday
Morning All I'm being driven nuts by dates. I have a 'date_time' collumn currently set to TEXT. I am simply trying to get the records from yesterday. So the following should work: SELECT date(date_time,'-1 days') as DATE from tmp_dspace_import as should... SELECT strftime('%Y-%m-%d',date_tim

Re: [sqlite] Date time functions not working

2017-08-24 Thread Matthew Halliday
24, 2017 at 10:27 AM, Clemens Ladisch wrote: > Matthew Halliday wrote: > > SELECT strftime('%Y-%m-%d',date_time , '-1 days') as DATE from > > tmp_dspace_import > > > > If I run it as a stand-alone single statement it works. > > > > If I

Re: [sqlite] Date time functions not working

2017-08-24 Thread Matthew Halliday
lumns in group by. > You should have grup by 1,2,3. Column 3 > is expression. > > Regards, > Radovan > > Matthew Halliday je 24.08.2017 ob 11:41 napisal: > > Correct: >> >> SELECT strftime(date_time, -2) as iDATE from tmp_dspace_import >> >> >> Res

Re: [sqlite] Date time functions not working

2017-08-24 Thread Matthew Halliday
total report. These will be generated from a Powershell script - that bit works fine. Matt On Thu, Aug 24, 2017 at 11:07 AM, Clemens Ladisch wrote: > Matthew Halliday wrote: > > select servername, drive, strftime(date_time, -2) as iDATE, > SUM(diff_used) AS DailyUsed > > from

Re: [sqlite] Date time functions not working

2017-08-24 Thread Matthew Halliday
Looks like it's me. VBScript "NOW" = dd/mm/ whereas ISO "NOW" = /mm/dd. Doh! Last part of the INSERT string reads: ,'" & strFreeSpace & "','" & pctFreeSpace & "','" & NOW & "');" Changing it to: ,'" & strFreeSpace & "','" & pctFreeSpace & "', datetime('NOW') ); so it inser

Re: [sqlite] Date time functions not working

2017-08-24 Thread Matthew Halliday
DOH! Its set to UK but date wrong way round. Thought I checked that. Laptop was provided pre-imaged and locked down. No admin rights - had to fight hard for them! Fixed it. On Thu, Aug 24, 2017 at 2:30 PM, Warren Young wrote: > On Aug 24, 2017, at 7:21 AM, Matthew Halliday wr

Re: [sqlite] Date time functions not working

2017-08-24 Thread Matthew Halliday
w', '-1 days') > > you get: 2017-08-23 > > Regards > Radovan > > Matthew Halliday je 24.08.2017 ob 15:21 napisal: > > Looks like it's me. >> >> VBScript "NOW" = dd/mm/ whereas ISO "NOW" = /mm/dd. >&g