Re: [sqlite] Can it (should it) be done in SQL?

2020-01-20 Thread David Bicking
type,           max(0, amount)     from unks order by 1, 2; -- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users On >Behalf Of David Bicking >Sent: Saturday

[sqlite] Can it (should it) be done in SQL?

2020-01-18 Thread David Bicking
I suspect the answer is that it is best to do this in the application program. However, the platform I want to use is dumb as a brick. It basically can call sqlite3_get_table, mildly reformat the data and send it to the display. Anyway, there are two tables CREATE TABLE Goals (period integer pr

Re: [sqlite] Lazy JSON data to sqlite database

2019-01-19 Thread David Bicking
>> Is there a tool out there that will more or less automate the task for >> me? Hopefully free, as no one is paying me to do this. (The other >> volunteers have maybe a dozen records in total and are doing their >> reports by hand. ) >The automation is at a lower level than you seem to realize.

[sqlite] Lazy JSON data to sqlite database

2019-01-19 Thread David Bicking
Okay, I know this is just me being lazy, but I have a data file with JSON data, and I want to get the data into an sqlite database so I can run queries against it. It is not a large file, only about 600 records in the main table. I've never worked with JSON before, and really don't want to write

[sqlite] Task management schema

2018-04-25 Thread David Bicking
Okay, this is a "help me with my homework" type request, so feel free to tell me to go away. But I have been tasked with creating a simple task management system. For it, I need to store tasks: who is assigned, what is assigned, and when it is due. Where the task could be recurring, ie due the 1

Re: [sqlite] Protecting databases

2016-10-08 Thread David Bicking
If you are trying to protect against casual snooping, you could probably zip the sqlite data with a password then have your application unzip the data to a temp location on open, then re-zip at the end, deleting the unzipped file. Your application then would be able to use the normal sqlite cal

Re: [sqlite] Complicated join

2016-09-19 Thread David Bicking
index_M_1 (CombinedKeyField=?) The compares and such are going to blow up in size when translated to your real version with the 8 fields, which is what makes me cringe. -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of David Bicking

Re: [sqlite] Complicated join

2016-09-19 Thread David Bicking
, September 19, 2016 2:43 PM Subject: Re: [sqlite] Complicated join On 19-09-16 19:33, David Bicking wrote: > select E.CombinedKeyField, E.EvtNbr, M.EvtNbr > from E left join M > on E.CombinedKeyField = M.CombinedKeyField > and (E.EvtNbr = M.EvtNbr > or  M.EvtNbr = (SELECT MIN(M1.Ev

Re: [sqlite] Complicated join

2016-09-19 Thread David Bicking
ted join On 19-09-16 19:33, David Bicking wrote: > INSERT INTO M (CombinedKeyField, EvtNbr) > > VALUES ('A', 1), > ('A', 5); > > INSERT INTO E (CombineKeyField, EvtNbr) > VALUES ('A', 1) > , ('A', 2) > , ('A',

Re: [sqlite] Complicated join

2016-09-19 Thread David Bicking
essage - From: James K. Lowden To: sqlite-users@mailinglists.sqlite.org Sent: Monday, September 19, 2016 10:57 AM Subject: Re: [sqlite] Complicated join On Thu, 15 Sep 2016 15:53:10 + (UTC) David Bicking wrote: > (1) The CombinedKeyFields must always match in each table(2) Match

Re: [sqlite] Complicated join

2016-09-17 Thread David Bicking
e past I have been told reader end up seeing an unable to read small font on their end. From: R Smith To: sqlite-users@mailinglists.sqlite.org Sent: Saturday, September 17, 2016 7:25 AM Subject: Re: [sqlite] Complicated join On 2016/09/15 5:53 PM, David Bick

[sqlite] Complicated join

2016-09-15 Thread David Bicking
I have two tables: CREATE TABLE M ( CombineKeyFields, EvtNbr, TransDate, OtherFields, PRIMARY KEY(CombinedKeyFields, EvtNbr, TransDate));CREATE TABLE E  ( CombineKeyFields, EvtNbr, TransDate, OtherFields, PRIMARY KEY(CombinedKeyFields, EvtNbr, TransDate)); "CombinedKeyFields" is shorthand for a

Re: [sqlite] Does sqlite3 have variables like Oracle?

2016-09-12 Thread David Bicking
Sqlite doesn't have variable.  While last row id is available other ways, a trick to emulate a variable is to create a temp table with one field. You put the value in to the that field. You can then cross join with the rest of your table as need be, or do a sub-select to value a SET command. Da

[sqlite] MIN/MAX query

2016-02-18 Thread David Bicking
Whatever mangled the text must have put a 2 in front of the 7, cause the copy in my sent mail box has a 1 in front of the 7.?? I never got a copy of my email from the mailing list, so I never saw the mangled version, just quotes of it. I assumed you made the typo and didn't want to nit-pick some

[sqlite] MIN/MAX query

2016-02-18 Thread David Bicking
Thanks. You understood my intention, and confirmed my fear that I couldn't do it efficiently in SQL. David From: Igor Tandetnik To: sqlite-users at mailinglists.sqlite.org Sent: Thursday, February 18, 2016 9:59 AM Subject: Re: [sqlite] MIN/MAX query On 2/18/2016 4:55 AM, R Smith wrot

[sqlite] MIN/MAX query

2016-02-18 Thread David Bicking
Um, I understand sets; which is why I knew the naive group by wouldn't work. I guess I should have stated my question is HOW do I define the group so that in the order of I,L, clusters of common V values are a "group". I need to return the value of I and V, with the minimum and maximum L in that

[sqlite] MIN/MAX query

2016-02-17 Thread David Bicking
On 02/17/2016 03:22 PM, nomad at null.net wrote: > On Wed Feb 17, 2016 at 06:17:40PM +0000, David Bicking wrote: >> I have a table >> I L V1 1 A1 2 A1 3 A1 4 B1 5 B1 6 A1 7 A2 1 C2 2 C > The formatting of this (and your desired results) does not make the >

[sqlite] MIN/MAX query

2016-02-17 Thread David Bicking
I have a table I? L? V1 1?? A1 2?? A1 3?? A1 4?? B1 5 ? B1 6?? A1 7?? A2 1 ? C2 2?? C I want to return the minimal and maximum L for each "group" of V in a given I. The result I want: I? MinL? MaxL? V1? 1??? 3? A1? 4??? 5?? B1? 6??? 7?? A2? 1??? 2

Re: [sqlite] Performance gain in SQLite

2014-10-06 Thread David Bicking
I recall there is or once was a way to compile sqlite so that you could embed in your program the pre-generated sql. This was for embedded programs, not to speed things up, but to remove the parser and save memory in very small embedded systems. For it to work, the sql and the database schema could

Re: [sqlite] Application with 'grid' form for entering table data wanted

2014-06-04 Thread David Bicking
I don't know php, but this sounds like what I think you want: phpGrid | PHP Datagrid Made Easy. phpGrid | PHP Datagrid Made Easy. phpGrid is a simple, powerful and fully customizable PHP component for generating PHP AJAX datagrid for create, read, update, delete (CRUD) records. View on php

Re: [sqlite] Joining different databases

2014-05-29 Thread David Bicking
10:42 AM, David Bicking wrote: >> How complicated is the join? Could you show a hypothetical SQL statement > you would have used had both tables been in the same database? > > Not complicated:  Select b.id, b.name, b.otherfields from a inner join b on > a.id = b.id where

Re: [sqlite] Joining different databases

2014-05-29 Thread David Bicking
From: Igor Tandetnik To: sqlite-users@sqlite.org Sent: Thursday, May 29, 2014 10:34 AM Subject: Re: [sqlite] Joining different databases On 5/29/2014 10:26 AM, David Bicking wrote: >> I have a somewhat large table in an sqlite database and a

[sqlite] Joining different databases

2014-05-29 Thread David Bicking
I have a somewhat large table in an sqlite database and another large table on an MS SQL Server database (on a slow network).  I want to query both tables in a join. The join is likely to produce from zero to a dozen rows. First thought was to copy the data from the SQL Server table to the sql

Re: [sqlite] Windows user app to display input form + reporting?

2014-03-12 Thread David Bicking
On 03/12/2014 08:05 AM, Gilles Ganault wrote: On Wed, 12 Mar 2014 07:59:39 -0400, David Bicking wrote: Not exactly "lite" in size, but kexi does have most of the features of Access and uses sqlite to store its data: http://kexi-project.org/ Thanks for the link. It's currentl

Re: [sqlite] Windows user app to display input form + reporting?

2014-03-12 Thread David Bicking
On 03/11/2014 07:31 PM, Gilles Ganault wrote: Hello A friend needs to move from Excel to a database. The school won't pay for the full version of MS Office that includes Access, so recommended that she use LibreOffice Base instead. I just checked it out, and it seems to only be a front-

Re: [sqlite] partially excluding records

2014-02-24 Thread David Bicking
d On Fri, 2/21/14, Igor Tandetnik wrote: Subject: Re: [sqlite] partially excluding records To: sqlite-users@sqlite.org Date: Friday, February 21, 2014, 3:25 PM On 2/21/2014 3:11 PM, David Bicking wrote: > But I am curious, wouldn't thi

Re: [sqlite] partially excluding records

2014-02-21 Thread David Bicking
On Fri, 2/21/14, Igor Tandetnik wrote: Subject: Re: [sqlite] partially excluding records To: sqlite-users@sqlite.org Date: Friday, February 21, 2014, 2:58 PM On 2/21/2014 1:23 PM, David Bicking wrote: >> SELECT Key, COUNT(STATU

Re: [sqlite] partially excluding records

2014-02-21 Thread David Bicking
On Fri, 2/21/14, Clemens Ladisch wrote: Subject: Re: [sqlite] partially excluding records To: sqlite-users@sqlite.org Date: Friday, February 21, 2014, 1:38 PM David Bicking wrote: >> The complication is that if a given key has any non-C

Re: [sqlite] partially excluding records

2014-02-21 Thread David Bicking
On Fri, 2/21/14, RSmith wrote: Subject: Re: [sqlite] partially excluding records To: sqlite-users@sqlite.org Date: Friday, February 21, 2014, 1:34 PM On 2014/02/21 20:23, David Bicking wrote: > I have a table like > > SELECT

[sqlite] partially excluding records

2014-02-21 Thread David Bicking
I have a table like SELECT * FROM T1; Key Status 1 O 1 O 2 O 2 C 3 C 3 C 4 O 4 P Now, I need to consolidate that data. SELECT Key, COUNT(STATUS) Cnt , MIN(STATUS) || CASE WHEN COUNT(STATUS)>1 THEN '+' ELSE '' END Statuses FROM T1 WHERE ... GROUP BY KEY;

Re: [sqlite] Proposed enhancement to the sqlite3.exe command-line shell

2014-02-10 Thread David Bicking
The first time I saw sqlite demonstrated at a linux user group, the presenter didn't realize he was using a memory database. I had to explain why all his work was lost, then proceeded to continue the demo since I knew more about the product. (This was years ago, I think we were still at sqlite 2

Re: [sqlite] (no subject)

2014-01-28 Thread David Bicking
On Tue, 1/28/14, Igor Tandetnik wrote: Subject: Re: [sqlite] (no subject) To: sqlite-users@sqlite.org Date: Tuesday, January 28, 2014, 2:41 PM On 1/28/2014 2:26 PM, David Bicking wrote: > I have two tables: > > ARB >   KEY

[sqlite] (no subject)

2014-01-28 Thread David Bicking
I have two tables: ARB KEY (PRIMARY KEY) ASSIGN (NOT NECESSARILY UNIQUE) DMC KEY (NOT UNIQUE) ASSIGN (NOT UNIQUE) VALUE I need to report all the records from ARB, and sum up the values if the keys match OR if the keys don't match, then sum up the values where the ASSIGN matches, but only

Re: [sqlite] Does not detect invalid column name when subexpression optimized away

2013-12-19 Thread David Bicking
But isn't NULL and 0 a NULL? So wouldn't it need to evaluate X to determine if it was null, and thus discover it wasn't a valid column name and return an error? David On Thu, 12/19/13, Richard Hipp wrote: Subject: Re: [sqlite] Does not detect inva

Re: [sqlite] Is this a proper syntax?

2013-10-24 Thread David Bicking
On 10/24/2013 07:34 PM, Igor Korot wrote: Igor, On Thu, Oct 24, 2013 at 12:57 PM, Igor Tandetnik wrote: On 10/24/2013 3:23 PM, Igor Korot wrote: Will this query work: UPDATE a SET a.field1 = (SELECT b.field1 FROM b AS myfield), a.field2 = myfield... or I will have to repeat subquery for

Re: [sqlite] Insert statement

2013-09-08 Thread David Bicking
You might be able to store your "variable" in a table: CREATE TABLE table_lastid  (id INTEGER); INSERT INTO table_lastid (id) VALUES(0); Then in your sequence: INSERT INTO table_a (val) VALUES ('xx'); UPDATE table_lastid SET id = last_insert_rowid(); INSERT INTO table_b (id, key, val)  

Re: [sqlite] SQLite Input with validation and lookup

2013-08-15 Thread David Bicking
I've never used Visual FoxPro, but I suspect that it allows you to create forms to insert data in to the database. Sqlite doesn't do that. Sqlite only provides the library to store the data via SQL statements that you execute via sqlite3_prepare()/sqlite3_step() function calls. You are expec

Re: [sqlite] Fuzzy joins

2013-03-11 Thread David Bicking
ldn't. But I am really close now. David From: Petite Abeille To: General Discussion of SQLite Database Sent: Monday, March 11, 2013 5:45 PM Subject: Re: [sqlite] Fuzzy joins On Mar 11, 2013, at 10:32 PM, David Bicking wrote: > Um, I am wrong, cause

Re: [sqlite] Fuzzy joins

2013-03-11 Thread David Bicking
abase Sent: Monday, March 11, 2013 3:24 PM Subject: Re: [sqlite] Fuzzy joins On Mar 11, 2013, at 4:54 PM, David Bicking wrote: > Am I missing an obviously better way to do it? > A way that can easily be expanded when they come back to me and say if I > looked at a fifth column, you

[sqlite] Fuzzy joins

2013-03-11 Thread David Bicking
This is a weird request. I have a table of data with no natural primary key. I need to update this table from a prior table, but some of the data fields can change over time, so I must be flexible on how I match. So the matching I need to do is something like this, if Key1 is unique in both tab

Re: [sqlite] SQLite3 Bug Report: The shell accepts some dot commands ending in semicolons while rejecting others.

2013-01-28 Thread David Bicking
From: Ryan Johnson To: sqlite-users@sqlite.org Sent: Monday, January 28, 2013 12:54 PM Subject: Re: [sqlite] SQLite3 Bug Report: The shell accepts some dot commands ending in semicolons while rejecting others. On 28/01/2013 12:08 PM, Larry Brasfield wrote:

Re: [sqlite] unique combination of concatenated column query

2013-01-27 Thread David Bicking
assuming you have a fixed number of bin values, you can do something like this: CREATE TABLE myTable (component REAL,bin INTEGER,prd INTEGER); INSERT INTO myTable VALUES (2.1,1,217); INSERT INTO myTable VALUES (6.5,4,217); INSERT INTO myTable VALUES (7.1,3,217); INSERT INTO myTable VALUES (7.6,5,2

Re: [sqlite] Subject: Re: Simple SQLite-based spreadsheet?

2012-12-08 Thread David Bicking
I will say one of the spreadsheet like functions I have wanted, and haven't really seen, is the ability to copy a value in to the column in multiple rows. MS Access doesn't allow that, but it is trival in a spreadsheet, just highlight the cells, and Ctrl-D to copy the value down.. I don't recall

Re: [sqlite] just a test

2012-12-08 Thread David Bicking
I don't know what gmail is doing, but this is the first of your messages that I have seen for a long time. I thought you had left, except I'd occasionally see you quoted in someone's else email. Yahoo mail was completely dropping your email; not in spam, just not there. David - Original

Re: [sqlite] Simple SQLite-based spreadsheet?

2012-12-07 Thread David Bicking
>From: Gilles Ganault >On Fri, 7 Dec 2012 13:37:45 +, Simon Slavin wrote: >Use the free SQLite shell tool downloadable from the SQLite site. > >Write your own interface in PHP using the sqlite3 interface which does exactly >what you want. >Thanks but before I build my own, I wanted to chec

Re: [sqlite] Inserting from another table...

2012-07-06 Thread David Bicking
Have you tried to replace the "Insert into values(" with just "Select (" to make sure the values are what you expect them to be. That might also point out if any of them are null. David From: Sam Carleton To: General Discussion of SQLite Database Sent:

Re: [sqlite] Why can't sqlite disregard unused outer joins?

2012-05-29 Thread David Bicking
If Uniform has a given EmployeeName twice, you will get the Employee.Name twice in this query. Thus it would be a different result than if you did not join with Uniform. David From: Charles Samuels To: General Discussion of SQLite Database Sent: Tuesday, M

Re: [sqlite] rearranging 2 fields into 1 based on an order indicator in 2 other fields

2012-05-29 Thread David Bicking
Create Table table2 (Field3, FieldC); insert into table2 (Field3, FieldC) Select Field1x, FieldAx from Table1; insert into table2 (Field3, FieldC) Select Field2y, FieldBy from Table1; this will put your data in to the new table. I suspect the rowids won't match what you want, but you can always o

Re: [sqlite] don't understand what "query" returns...

2012-05-12 Thread David Bicking
I don't know python, but because you have count(*) and no group by, it will only return one row, with the total rows that matched your where clause. The Item1, Item2, Item3 are arbitrary values that were in the two rows of your data. You can either remove the count(*) and get both rows, or as

Re: [sqlite] is SQLite the right tool to analyze a 44GB file

2012-05-07 Thread David Bicking
Did you remember to specify the file name when you started sqlite3. If you don't give the file name, everything is done to the memory database and is discarded when you exit. David From: peter korinis To: sqlite-users@sqlite.org Sent: Monday, May 7, 2012 5:

Re: [sqlite] is SQLite the right tool to analyze a 44GB file

2012-05-07 Thread David Bicking
>From the docs: .separator STRING Change separator used by output mode and .import replace string with a comma, without quotes, then do your import. It should work. David From: peter korinis To: sqlite-users@sqlite.org Sent: Monday, May 7, 2012 1:34 PM

Re: [sqlite] How to access values of a columns with specific row id.

2012-01-31 Thread David Bicking
On 01/31/2012 04:05 AM, bhaskarReddy wrote: Hi Friends, Can any one tell me how to access values of a table column with its particular row id. I tried with "select * from ontTable where rowid=2;" I am getting the output as 1|2|3|XYZ234|4|ABCD123|5.

Re: [sqlite] Calculating MSO

2011-12-16 Thread David Bicking
te.org Sent: Friday, December 16, 2011 4:05 PM Subject: Re: [sqlite] Calculating MSO David Bicking wrote: > The calculation is that for each customer: > MSO = (Per + (AR-sum(Sales)/Sales)) > > Result > Cust MSO > 01 2.3 = (3+(100-120)/60)) You have more closing parenthese

[sqlite] Calculating MSO

2011-12-16 Thread David Bicking
I need to calculate Months Sales Outstanding. CREATE TABLE  AR     Cust    Text     AR    Double CREATE TABLE Sales     Cust    Text     Per    Integer -- runs 1, 2, 3, etc     Sales    Double The calculation is that for each customer: MSO = (Per + (AR-sum(Sales)/Sales))        Where Per an

Re: [sqlite] Slow INDEX

2011-11-02 Thread David Bicking
On 11/02/2011 12:31 PM, Fabian wrote: 2011/11/2 Mr. Puneet Kishor Others will have better answers, but methinks that when you reboot the computer, the operating system's caches are flushed out, which slows the operation. Try working with the db for a bit (SELECT, repeat INSERTs, etc.) and noti

Re: [sqlite] Slow JOIN on ROWID

2011-10-14 Thread David Bicking
On 10/14/2011 06:39 AM, Fabian wrote: Exactly. I still don't have optimal performance in the query (although it's much better now), and it seems to be related to ORDER BY. When I execute: SELECT * FROM table WHERE data = 10 LIMIT 250 OFFSET 50 It's very fast, but it's get much slower

Re: [sqlite] Hidding records from the application

2011-07-16 Thread David Bicking
lient1 can see all the records except > rowid 1. > It looks like temporary view and temporary table is good solutions, > which one is better and which one could be more efficient? > > > > 2011/7/16, David Bicking: >> I don't know I have much to offer here as I still

Re: [sqlite] Hidding records from the application

2011-07-16 Thread David Bicking
I don't know I have much to offer here as I still really don't understand what you are trying to accomplish. But I looked and it appears that sqlite supports TEMPORARY VIEW, which, I believe, is only visible to the process that created it. And it will automatically go away when that process end

Re: [sqlite] Ensure that query acts on PRE-SORTED tables

2011-07-01 Thread David Bicking
Part of the problem here is that you are misusing the term BETWEEN. In SQL txt BETWEEN 1990 AND 1991 means those rows where the value of txt is >= 1990 AND <= 1991. It has nothing to do with the order of the rows in the table, it is purely a comparison of the value of txt in a particular row and

Re: [sqlite] Ensure that query acts on PRE-SORTED tables

2011-07-01 Thread David Bicking
I'm not entirely sure what your data looks like, but I am thinking that when you say "txt BETWEEN 'x1' AND 'x2'" you mean those rows between the row where txt = 'x1' and the row where txt = 'x2' If that is the case, maybe this will give you what you want: SELECT POS FROM T_x WHERE POS BETWEEN

Re: [sqlite] Howto...multi-sqlite command string through sqlite3_prepare_v2() to create SINGLE statement

2011-06-21 Thread David Bicking
ou can probably gather...this is very new to me. > > On 21 June 2011 12:48, David Bicking wrote: > >> On 06/21/2011 07:22 AM, e-mail mgbg25171 wrote: >>> The commented out lines work. >>> I'm wondering... >>> a) is it possible to do what'

Re: [sqlite] Howto...multi-sqlite command string through sqlite3_prepare_v2() to create SINGLE statement

2011-06-21 Thread David Bicking
On 06/21/2011 07:22 AM, e-mail mgbg25171 wrote: > The commented out lines work. > I'm wondering... > a) is it possible to do what's not commented out > b) what's the syntax re the "sql =..." and "sql +=..." lines > Any help much appreciated! > > > sql = "BEGIN"; //you need to add newline here > s

[sqlite] query to find mixed values

2011-04-26 Thread David Bicking
I have two tables: CREATE TABLE INV ( REQ int, INV char, AMT float ); CREATE TABLE REP ( REQ int, ACCT char AMT float ); I need to flag any combinations where for a given REQ value, one table has a list of numbers of mixed signs, and the other table has one and only one value. So REQ|I

Re: [sqlite] BUG (3.7.5): identifier quotation characters get part of column names for certain statements

2011-02-10 Thread David Bicking
--- On Thu, 2/10/11, Puneet Kishor wrote: > Date: Thursday, February 10, 2011, 10:35 AM > > On Thursday, February 10, 2011 at 9:22 AM, Nißl Reinhard > wrote: > > Hi, > > > > I'm sorry Pavel, I think you've got me wrong. > > > > > It's not "buggy". Name of the column in result > set is not de

Re: [sqlite] Bi-directional unique

2011-02-09 Thread David Bicking
I don't think this will work. xor(6,1) = 7 and xor(4,3) = 7, so you would fail to insert proper pairs. Or am I missing something? (At least I assume that the integers are not limited to just 1 2 or 3 as in the examples. David On 02/09/2011 05:58 PM, Samuel Adam wrote: > On Wed, 09 Feb 2011 13

Re: [sqlite] does sqlite differ between char, varchar and text?

2010-12-16 Thread David Bicking
Oh, and as I recall, sqlite2 completely ignored the type declaration. It stored what you typed in the schema, but did nothing with it. I am pretty sure that sqlite3 treats text, char and varchar completely the same. It ignores the number after char(x) or varchar(x). David --- On Thu, 12/16/10,

Re: [sqlite] does sqlite differ between char, varchar and text?

2010-12-16 Thread David Bicking
If I recall correctly, sqlite2 stores everything as text. It doesn't have a concept of affinity. Everythign is text and it will convert anything as needed. David --- On Thu, 12/16/10, Artur Reilin wrote: > From: Artur Reilin > Subject: [sqlite] does sqlite differ between char, varchar and tex

Re: [sqlite] Reading a text file and insert to sqlite tables

2010-12-09 Thread David Bicking
I suck at writing C, so I can't help you there, but what you basically need to do is read the lines of text that consist of one record in to variables for each field. You then bind these to placeholders for the insert statements. open file sql1 = prepare( "INSERT INTO myTABLE1 (field1, field2

Re: [sqlite] gui for data entry

2010-10-12 Thread David Bicking
Take a look at Kexi. (kexi-project.org) It is part of the Koffice suite, but can be used standalone. I had tested it on Windows and had no trouble installing it. It uses sqlite as its back end storage and allows you to create forms, etc. Its aim is to be "like" MS Access. David --- On Tue, 1

Re: [sqlite] Getting unique years from a timestamp column

2010-09-29 Thread David Bicking
base" > Date: Wednesday, September 29, 2010, 12:42 PM > This one doesn't seem to return the > desired result, instead it returned a > blank line? > > On Wed, Sep 29, 2010 at 12:40 PM, David Bicking > wrote: > > > How about trying > > > > select distinct

Re: [sqlite] Getting unique years from a timestamp column

2010-09-29 Thread David Bicking
How about trying select distinct datetime(date,'%Y') as year from data; David --- On Wed, 9/29/10, J. Bobby Lopez wrote: > From: J. Bobby Lopez > Subject: [sqlite] Getting unique years from a timestamp column > To: sqlite-users@sqlite.org > Date: Wednesday, September 29, 2010, 12:34 PM > Hel

[sqlite] Error message in RAISE(ABORT,...)

2010-08-26 Thread David Bicking
Can the Error message returned by a trigger be an expression? My testing seems to indicate that you can only put a string literal in the Raise function. What I am trying to do is return the data that the trigger was looking at when it raised the error. My application can insert one to four rec

Re: [sqlite] How to get the original rows after 'group by'?

2010-08-26 Thread David Bicking
you can use: select col1, col2 from test where col1 in (select col1 from test group by col1 having count(*)<=2); David --- On Thu, 8/26/10, Peng Yu wrote: > From: Peng Yu > Subject: [sqlite] How to get the original rows after 'group by'? > To: "General Discussion of SQLite Database" > Date:

Re: [sqlite] playing with triggers

2010-08-19 Thread David Bicking
--- On Thu, 8/19/10, Simon Slavin wrote: > > On 19 Aug 2010, at 8:10pm, David Bicking wrote: > > > The way it is set up, if any of the updates/inserts > done by the triggers fail, everything rolls back, including > the original data that caused the triggers. What I wan

[sqlite] playing with triggers

2010-08-19 Thread David Bicking
I am more or less playing with triggers trying to learn what they can do. I have a setup where I write data to Table1. An after insert trigger looks up the newly written data codes in Table1, and writes 1 to 4 records to Table2. An after insert trigger on Table2 looks at the new data and updates

Re: [sqlite] trigger or application code

2010-08-10 Thread David Bicking
select max(changedate) from changes where code = ? > ) > > or in the alternative > > select amount from changes where code = ? > order by changedate desc limit 1 > > > The problem with this approach is that any [code] value > under the sun is > acceptable; ther

[sqlite] trigger or application code

2010-08-10 Thread David Bicking
I am building an application with these two tables: CREATE TABLE changes(ChangeDate, Code, AdjAmount, Descr, Creatable); CREATE TABLE items(Code, Amount) Now, what I would like to happen, I insert in to changes, and it updates the Amount in items. I can get that with CREATE TRIGGER changes_aft

Re: [sqlite] list table structure

2010-08-02 Thread David Bicking
You would use pragma table_info(); http://www.sqlite.org/pragma.html#pragma_table_info --- On Mon, 8/2/10, Chris Hare wrote: > From: Chris Hare > Subject: [sqlite] list table structure > To: sqlite-users@sqlite.org > Date: Monday, August 2, 2010, 12:11 PM > I read on the SQLite how to get the

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-30 Thread David Bicking
On Wed, 2010-06-30 at 09:04 -0400, Tim Romano wrote: > > The EXAMPLE: If you create a database in the authoritative version of SQLite > using INT PRIMARY KEY (rather than INTEGER PRIMARY KEY), when you share the > database with your Adobe-using affiliate, all hell will break loose. I will > repea

Re: [sqlite] marking transaction boundaries

2010-06-23 Thread David Bicking
Did I miss Sqlite getting nested transactions? I thought it only had one transaction, in which you can have multiple savepoints, which are kind of sort of like nested transactions, but they use SAVEPOINT and not BEGIN. Doesn't an abort rollback the full transaction? David --- On Wed, 6/23/1

Re: [sqlite] Parametrized Queries issue (Possible bug)

2010-06-14 Thread David Bicking
I think in your first example, the :a comes first, so it is assigned the first index value. You then use ?1, which also uses the first parameter index. In the second, you use ?1 first, then :b, which sees the first index has been used and thus assigns it to the second index. As I believe Jay sa

Re: [sqlite] Get a specific sequence of rows...

2010-03-26 Thread David Bicking
On Fri, 2010-03-26 at 10:00 +0100, Fredrik Karlsson wrote: > Hi, > > I have a list of id:s stored in a field. I would now like to get some > information from a table by these id:s, but exactly in this order. So, > if I have a table > > 1 One > 2 Two > 3 Three > > and the sequence "3,1,2" stored

Re: [sqlite] Question about binding

2010-03-19 Thread David Bicking
--- On Fri, 3/19/10, Vance E. Neff wrote: > UPDATE table1 set (?, ?, ?) WHERE col1=? and col2=?; > > I've never used binding before but have known it is a good > idea in order > to avoid injection of bad stuff. > > Vance > You count the question marks from left to right. > UPDATE table1

Re: [sqlite] Shocked by long updates of the text database, 1000 speed improvement after small modification to the code.

2010-02-03 Thread David Bicking
As a test, have you tried wrapping your updates in a transaction? That would isolate if the slow down is the actual writing of the data to disk. Where is the file sitting: A local drive, or something across a network connection? David On Wed, 2010-02-03 at 08:51 -0800, a1rex wrote: > >-

Re: [sqlite] uninstalling sqlite

2010-01-02 Thread David Bicking
On Sun, 2010-01-03 at 03:09 +, Simon Slavin wrote: > On 3 Jan 2010, at 2:44am, Ervin Sebag wrote: > > > I installed sqlite myself from a compressed tar package, using the > > funpkg -i command. > > if -i does install, perhaps -u does uninstall. I can't find the > documentation for funpkg on

Re: [sqlite] BACK API Questions

2009-12-16 Thread David Bicking
Raghu, Can you either use the backup API or a simple attach to copy the data from the memory database to a new file based db. A second process could then much more slowly poll to see if a new "temporary" file was available, and attach it, and insert its data albeit slowly in to the consolidated fi

Re: [sqlite] Ideal way to check whether a table has a specific column

2009-11-03 Thread David Bicking
You could try to prepare a statement like "SELECT YourColumnName FROM YourTable;" If prepare returns an error, then likely the error message will say the column doesn't exist. If no error, it does exist. Such a simple query shouldn't take long to prepare. Probably less time then to grab the resu

Re: [sqlite] SUM(tripSeconds) and format output as days.hours:minutes:seconds.hundredths?

2009-11-02 Thread David Bicking
I probably should have explicitly stated that my suggestion only worked up to 24 hours. Unfortunately I couldn't think of a solution for greater values. Yesterday Igor posted a solution that works with days. You never responded to him so perhaps you didn't see it. I'll copy it here: ** SELECT

Re: [sqlite] SUM(tripSeconds) and format output as days.hours:minutes:seconds.hundredths?

2009-11-01 Thread David Bicking
On Sun, 2009-11-01 at 12:15 -0800, DaleEMoore wrote: > I'd like to SUM(tripSeconds) and format output as > days.hours:minutes:seconds.hundredths, but have not been able to figure out > how to do that with sqlite. This didn't seem to come close: > > SELECT > STRFTIME('%d', SUM(tripSeconds)) + '.'

Re: [sqlite] (no subject)

2009-10-27 Thread David Bicking
lect * from assets; > C0|name1|name2 > sqlite> insert into assets select 'C0', 'name1', 'name3' > where not > exists (select 1 from assets where Code='C0' and > acct1='name1'); > sqlite> select * from assets; > C0|name1

[sqlite] (no subject)

2009-10-27 Thread David Bicking
I have a table ASSETS with fields (Code Text, Acct1 Text, Acct2 Text). (There are other fields, and the primary key is a combination of 5 columns) For one code ('C0') I want to implement a rule that if I attempt to insert a combination of 'C0'/Acct1/Acct2 it will be ignored if the first two keys

Re: [sqlite] controlling changes

2009-10-10 Thread David Bicking
On Sat, 2009-10-10 at 19:31 +0100, Simon Slavin wrote: > On 10 Oct 2009, at 5:08pm, David Bicking wrote: > > > I have a table: > > CREATE TABLE Assets > > ( ControlDate Date > > , Amt > > ) > > There is no such column type as 'Date' in SQLi

Re: [sqlite] controlling changes

2009-10-10 Thread David Bicking
Can you show me what the constraint would look like? Thanks, David On Sat, 2009-10-10 at 09:11 -0700, Harold Wood & Meyuni Gani wrote: > You can do it as a constraint. > > -Original Message- > From: David Bicking > Sent: Saturday, October 10, 2009 9:08 AM > To: s

[sqlite] controlling changes

2009-10-10 Thread David Bicking
I have a table: CREATE TABLE Assets ( ControlDate Date , Amt ) Now, the business rules are you can INCREASE the Amt if the Current Date is the ControlDate in the record. You can DECREASE the amount if the Current Date is greater than or equal to the ControlDate. Can this be enforced v

[sqlite] exceptions to check constraints

2009-10-10 Thread David Bicking
I've never had to deliberately use check constraints in my projects, but I would like to use them on a new projects. I've googled the subject, but found no good explanations. I have a table CREATE TABLE Assets ( Nametext PRIMARY KEY , Amt integer ); Now, for 99% of the record

Re: [sqlite] Problems with max(datestamp) in subquery

2009-08-17 Thread David Bicking
On Mon, 2009-08-17 at 15:05 -0700, Leo Freitag wrote: > David Bicking-2 wrote: > > > > As written, you were selecting any record with the correct date > > regardless of Ensemble or Steuck. > > > > David > The following seem to work: > >

Re: [sqlite] SELECT * from ?

2009-08-12 Thread David Bicking
On Thu, 2009-08-13 at 01:12 +0100, Simon Slavin wrote: > On 12 Aug 2009, at 11:35pm, Igor Tandetnik wrote: > > > Bill Welbourn > > wrote: > >> I am new to the forum and have a question regarding querying data > >> from a table, where the table name is random. For example, I have a > >> database p

Re: [sqlite] Problems with max(datestamp) in subquery

2009-08-12 Thread David Bicking
On Wed, 2009-08-12 at 07:02 -0700, Leo Freitag wrote: > > I modified the code a get the following results. Unfortunetly only a little > more as expected: > > DROP TABLE 'tblZO_Haupt'; > CREATE TABLE 'tblZO_Haupt' ('id' INTEGER PRIMARY KEY, 'zo_tblEnsemble' > INTEGER, 'zo_tblSaenger' INTEGER, 'zo

Re: [sqlite] Date Comparisons SQL

2009-08-03 Thread David Bicking
I think your problem is that you need to put the value in sDateTemp in quotes. "WHERE Date < '" & sDateTemp & "'" or "WHERE Format$(Date, "-mm-dd") < '"& sDateTemp & "'" Without the quote, I think sqlite is subtracting the day from the month from the year, and comparing that number with the

Re: [sqlite] sqlite version 2.8 vs 3.x

2009-07-30 Thread David Bicking
On Thu, 2009-07-30 at 09:18 -0430, An wrote: > my question stayed unanswered, so that is why i'm repeating it on the > mailinglist: > > if sqlite2.8 will be supported of bugs the following years, as the web page > says, what is another reason for working with version 3.x instead of 2.8 ? > > i'm

  1   2   >