[sqlite] another challenging query

2014-06-20 Thread David M. Cotter
here's a table: i want to delete from the table all records with plID = 1, but ONLY those that have a corresponding record where plID == 851090 and where that record's soID matches the one where plID = 1 so the query should delete rows 8-12, but leave 1-2 intact (and also leave 3-7) there ma

Re: [sqlite] another challenging query

2014-06-19 Thread David M. Cotter
you guys are flippin' gods ya know that right? thanks! On Jun 19, 2014, at 10:26 PM, Igor Tandetnik wrote: > On 6/20/2014 1:20 AM, David M. Cotter wrote: >> i want to delete from the table all records with plID = 1, but ONLY those >> that have a corresponding record wher

Re: [sqlite] another challenging query

2014-06-19 Thread David M. Cotter
> here's a table: the list helpfully deletes enclosed pictures, even if they're wicked small.. here's the actual table: http://karaoke.kjams.com/screenshots/table.png ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/ma

[sqlite] another challenging query

2014-06-19 Thread David M. Cotter
here's a table: i want to delete from the table all records with plID = 1, but ONLY those that have a corresponding record where plID == 851090 and where that record's soID matches the one where plID = 1 so the query should delete rows 8-12, but leave 1-2 intact (and also leave 3-7) there ma

Re: [sqlite] Help forming query

2014-06-19 Thread David M. Cotter
> SELECT DISTINCT column FROM table WHERE column not NULL; this is exactly what I needed, thanks! ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Help forming query

2014-06-17 Thread David M. Cotter
er tables) then i'd ask again, this time i'd get a 4, repeat above then ask again, get nothing, and i'd be done On Jun 17, 2014, at 10:54 PM, David M. Cotter wrote: > i have a table with a numeric column (not the key column) > i want to obtain from this table a list of uni

[sqlite] Help forming query

2014-06-17 Thread David M. Cotter
i have a table with a numeric column (not the key column) i want to obtain from this table a list of unique numbers appearing in that one column some cells in the column may have nothing, some may have duplicate numbers eg: > 1 > 1 > 1 > 4 > _ > _ > 4 > _ note that "_" means "no data". i want

Re: [sqlite] help writing DELETE with JOIN

2013-11-16 Thread David M. Cotter
okay i realize my requirements were wrong, here's a better summary: the plID (playlist ID) in the song table is different (the OLD id 33), the plID in the playlist table is the new ID 35, so i have to test them separately. the song ID's must match the playlist table's index is the plID, so i gu

[sqlite] help writing DELETE with JOIN

2013-11-15 Thread David M. Cotter
i have a "song" table S that has "songID", "playlistID", and "stale" (boolean) as columns (among others) i have a "playlist" table P that has "playlistID" and "songID" as columns (among others) for a particular playlistID X, i want to delete all rows from P who's (P.playlistID == S.playlistID =

Re: [sqlite] Can i change the primary key?

2013-11-13 Thread David M. Cotter
ah! this was my answer! thanks! On Nov 11, 2013, at 6:03 AM, Igor Tandetnik wrote: > On 11/10/2013 8:12 PM, David M. Cotter wrote: >> what i did before SQL was to just tell the new song (which may have updated >> / corrected meta data) to have the old song ID (and tell the

[sqlite] Can i change the primary key?

2013-11-11 Thread David M. Cotter
i've got say a music database the unique "song ID" is the "integer primary key", used to look up the song and all it's data sometimes an update of the meta data comes along, so i want to update to the new list, but preserve the old song IDs (so playlists that refer to them still link up) what

Re: [sqlite] will FTS speed up [LIKE '%foo%'] searches? or: how does iTunes do it?

2011-02-18 Thread David M. Cotter
> Did you read the page at the URL I gave ? It answers the question. yes the page shows an extremely unhelpful comparison: > SELECT count(*) FROM enrondata1 WHERE content MATCH 'linux'; /* 0.03 seconds > */ > SELECT count(*) FROM enrondata2 WHERE content LIKE '%linux%'; /* 22.5 seconds > */ the

Re: [sqlite] will FTS speed up [LIKE '%foo%'] searches? or: how does iTunes do it?

2011-02-16 Thread David M. Cotter
>> SELECT p.piIx FROM playlist p JOIN song s ON p.soID = s.soID WHERE p.plID = >> 99662 AND (s.name LIKE "%love%" OR s.arts LIKE "%love%" OR s.pUSD LIKE >> "%love%" OR s.pbls LIKE "%love%" OR s.genr LIKE "%love%") ORDER BY s.pbls >> ASC, s.name ASC, s.albm ASC, p.piIx ASC > > Good grief, no tha

Re: [sqlite] will FTS speed up [LIKE '%foo%'] searches? or: how does iTunes do it?

2011-02-16 Thread David M. Cotter
>> iTunes has "update search results as you type" speed even when you have a >> hundred thousand songs and you're searching on a partial string on all meta >> data columns. >> >> how on earth do they do that? >> >> i'm under the impression it uses CoreData, which in turn uses SQLite under >> t

[sqlite] will FTS speed up [LIKE '%foo%'] searches? or: how does iTunes do it?

2011-02-15 Thread David M. Cotter
iTunes has "update search results as you type" speed even when you have a hundred thousand songs and you're searching on a partial string on all meta data columns. how on earth do they do that? i'm under the impression it uses CoreData, which in turn uses SQLite under the hood. how can i make

Re: [sqlite] threads and transactions

2011-02-06 Thread David M. Cotter
complete and there are no errors or aborts do i then just "merge" the store DB with the main DB, but this depends on the ability to run a single "merge" command? is there such a thing? On Feb 6, 2011, at 9:56 AM, Simon Slavin wrote: > > On 6 Feb 2011, at 5:42pm, David M.

Re: [sqlite] threads and transactions

2011-02-06 Thread David M. Cotter
> If you don't need this behaviour because you're confident you'll never get a > clash, then you could accumulate your INSERTs in memory, then blast through > them when you would previously have just done the COMMIT. i will never have a clash because i manage the primary keys myself. is there a

Re: [sqlite] threads and transactions

2011-02-05 Thread David M. Cotter
forgive my not understanding this but i'm trying to be extremely clear and i am not sure from your answer whether you have understood my question. > In SQLite every write is in a transaction whether you declare one with BEGIN > or not. If you don't declare a transaction, SQLite invisibly surro

Re: [sqlite] threads and transactions

2011-02-05 Thread David M. Cotter
quot;begin > immediate" or by executing insert/update/delete after "begin") no > other connection can start a writing transaction (it still can do > read-only transactions for a while). > > If you need a different behavior you need to use some other DBMS. > > >

Re: [sqlite] threads and transactions

2011-02-05 Thread David M. Cotter
> Transactions are per-connection and have nothing to do > with threads. If you want different transactions in each thread you > need to make one connection for each thread. But those transactions > won't be able to execute simultaneously. so if i open a separate connection on each thread then eac

[sqlite] threads and transactions

2011-02-05 Thread David M. Cotter
i'm sure this topic has been beaten to death but i just really want to make sure. i'm using ONE database, and one handle to it on all threads here's a theoretical timeline -- 1) thread 1 begin transaction do bunches of stuff 2) thread 2 begin transaction do bunches of stuff 3)