RE: [sqlite] Limit statement size?

2007-01-28 Thread Joe Wilson
I forgot to specify the unique key for the table to be updated in the first attempt at INSERT OR REPLACE. Please try this... insert or replace into A3Test115_J( PATIENT_ID, ---<--- ENTRY_ID_E2, READ_CODE_E2, TERM_TEXT_E2, ... NUMERIC_VALUE_E15 ) select t1.PATIENT_ID,

Re: [sqlite] Limit statement size?

2007-01-28 Thread Joe Wilson
--- Joe Wilson <[EMAIL PROTECTED]> wrote: > I think this technique might be more compact and efficient than the update: I think my suggestion may result in duplicate rows. If the INSERT or REPLACE doesn't work, you might try: 1. BEGIN 2. dump the joined select into a temp table 3. delete the

RE: [sqlite] Limit statement size?

2007-01-28 Thread RB Smissaert
Thanks, will have a look at that. It definitely looks better. RBS -Original Message- From: Joe Wilson [mailto:[EMAIL PROTECTED] Sent: 28 January 2007 20:10 To: sqlite-users@sqlite.org Subject: Re: [sqlite] Limit statement size? I think this technique might be more compact and

Re: [sqlite] Limit statement size?

2007-01-28 Thread Joe Wilson
I think this technique might be more compact and efficient than the update: insert or replace into A3Test115_J( ENTRY_ID_E2, READ_CODE_E2, TERM_TEXT_E2, ... NUMERIC_VALUE_E15 ) select g2.ENTRY_ID, g2.READ_CODE, g2.TERM_TEXT, ... g15.NUMERIC_VALUE from A3Test115_J t1,

RE: [sqlite] Limit statement size?

2007-01-28 Thread RB Smissaert
> The UPDATE statement in the original example is a way to > compensate for SQLite's inability to perform a join on > another table before doing an UPDATE. Yes, I remember trying to do this at first via joins, but I couldn't get that to work and ended up with the current solution. Still, it

RE: [sqlite] Limit statement size?

2007-01-28 Thread Joe Wilson
--- Fred Williams <[EMAIL PROTECTED]> wrote: > Wow! Talk about obfuscated code! I didn't even try to dig deeper than > a quick scan, but could this abomination be broken into multiple update > queries? On the surface it looks like each "group" is unique. If so, > wouldn't a transaction with

RE: [sqlite] Limit statement size?

2007-01-28 Thread RB Smissaert
I don't think normalization comes into play here. These are a whole of manipulations to transpose a table. My normal base tables are all normalized fine. RBS -Original Message- From: Clay Dowling [mailto:[EMAIL PROTECTED] Sent: 28 January 2007 19:01 To: sqlite-users@sqlite.org Subject:

Re: [sqlite] Limit statement size?

2007-01-28 Thread Clay Dowling
You have any way to normalize that original source table? It's full of extents, which is the first sign of badness in a table design and assured of complicating your life. Clay RB Smissaert wrote: > Yes, I agree it looks messy, but I used to do this in steps and after advice > I think from Igor

RE: [sqlite] Limit statement size?

2007-01-28 Thread RB Smissaert
Yes, I agree it looks messy, but I used to do this in steps and after advice I think from Igor Tandenik I lumped it all together and run it in one go, which is a lot faster. RBS -Original Message- From: Fred Williams [mailto:[EMAIL PROTECTED] Sent: 28 January 2007 18:49 To:

RE: [sqlite] Limit statement size?

2007-01-28 Thread RB Smissaert
OK, thanks, size of the query shouldn't be a problem then. Performance is fine as well. This particular query ran in 1.4 secs, which in my app is fine as it is reporting software and results are expected to take a bit of time. This query is the final query of a number of queries that transpose a

RE: [sqlite] Limit statement size?

2007-01-28 Thread Fred Williams
Wow! Talk about obfuscated code! I didn't even try to dig deeper than a quick scan, but could this abomination be broken into multiple update queries? On the surface it looks like each "group" is unique. If so, wouldn't a transaction with multiple update statements be much more efficient and a

Re: [sqlite] Limit statement size?

2007-01-28 Thread drh
"RB Smissaert" <[EMAIL PROTECTED]> wrote: > Is there any limit on the size of the SQL statements in SQLite? 32-bit integers are used to count things in various places. I don't really consider that a limit, but some people do. See http://www.sqlite.org/cvstrac/tktview?tn=2125 There may be other

[sqlite] Limit statement size?

2007-01-28 Thread RB Smissaert
Is there any limit on the size of the SQL statements in SQLite? Didn't think this would come into play, but have now come across this query and wonder if this needs considering: UPDATE A3Test115_J SET ENTRY_ID_E2 = (SELECT ENTRY_ID FROM GROUP_2 T WHERE PATIENT_ID = T.PID), READ_CODE_E2 = (SELECT

[sqlite] Re: Re: Re: An SQL question (Not directly related to SQLite)

2007-01-28 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: So I could just use SELECT ..., SUM(`downloadCount`) FROM ... WHERE `pid` = (SELECT `id` FROM ...) GROUP BY `price`; Is that going to do the same as SELECT SUM(`downloadCount` FROM (SELECT ... FROM ... WHERE `pid` = (SELECT ...)) GROUP BY `price`; ? Yes, these two will

Re: [sqlite] Re: Re: An SQL question (Not directly related to SQLite)

2007-01-28 Thread ivailo91
On Saturday, January 27, 2007, 10:10:27 PM, Igor Tandetnik wrote: > [EMAIL PROTECTED] wrote: >> Actually, my query is something like >> SELECT ... FROM ... WHERE `pid` = (SELECT `id` FROM ...); >> if i put that group by... will it group all rows, or only those with >> the