Re: [sqlite] sqlite & INNER JOIN & vtable

2014-07-07 Thread Hick Gunter
[mailto:mickamus...@gmail.com] Gesendet: Montag, 07. Juli 2014 17:11 An: General Discussion of SQLite Database Betreff: [sqlite] sqlite & INNER JOIN & vtable Hi, In my case I've a normal sqlite table : toto and an vtable : special This is the typical request that I have : SELECT toto.

Re: [sqlite] sqlite & INNER JOIN & vtable

2014-07-07 Thread Pasha
Virtual tables are just like any other tables. The kind of join is the matter of you expectations from the query outcome. > Hi, > > In my case I've a normal sqlite table : toto > and an vtable : special > > This is the typical request that I have : > > SELECT toto.id, toto.name, special.info FRO

[sqlite] sqlite & INNER JOIN & vtable

2014-07-07 Thread Micka
Hi, In my case I've a normal sqlite table : toto and an vtable : special This is the typical request that I have : SELECT toto.id, toto.name, special.info FROM toto INNER JOIN special ON ( special.id = toto.specialid AND toto.test == TRUE ) I don't know if I should use LEFT JOIN, RIGHT JOIN or

Re: [sqlite] inner join problem

2012-05-06 Thread Keith Medcalf
> update dzhhq set mnote= > case when mnote in (select mnote from dzhhq inner join (select bs,stkcode > from buysell) b on dzhhq.stkcode=b.stkcode) then 'sell'||mnote > else mnote > end > is ok, but when I use this cmd then appear error msg: > update dzhhq set mnote= > case when mnote in (sele

[sqlite] inner join problem

2012-05-06 Thread YAN HONG YE
update dzhhq set mnote= case when mnote in (select mnote from dzhhq inner join (select bs,stkcode from buysell) b on dzhhq.stkcode=b.stkcode) then 'sell'||mnote else mnote end is ok, but when I use this cmd then appear error msg: update dzhhq set mnote= case when mnote in (select mnote from dzh

Re: [sqlite] INNER JOIN Optimization

2011-05-04 Thread Pavel Ivanov
> The problem is that I would like to avoid splitting the query into two parts. > I would expect SQLite to do the same thing for me automatically (at least in > the second scenario), but it does not seem to happen... Why is that? In short, because SQLite cannot read your mind. To understand the

[sqlite] INNER JOIN Optimization

2011-05-04 Thread petmal Malik
Hello. I have two tables to join. TABLE_A (contains column 'a') and TABLE_BC (contains columns 'b' and 'c'). There is a condition on TABLE_BC. The two tables are joined by 'rowid'. Something like: SELECT a, b, c FROM main.TABLE_A INNER JOIN main.TABLE_BC WHERE (b > 10.0 AND c < 10.0) ON main.

Re: [sqlite] Inner Join Performance Issue

2009-10-22 Thread John Crenshaw
, 2009 4:55 PM To: 'General Discussion of SQLite Database' Subject: Re: [sqlite] Inner Join Performance Issue I just ran EXPLAIN, how can I tell if the Indexes are used? I just read, that with an operator "like '%a%'" SQLite won't use an Index. Is this the case? Than

Re: [sqlite] Inner Join Performance Issue

2009-10-22 Thread Simon Slavin
On 22 Oct 2009, at 9:55pm, Ralf wrote: > I just read, that with an operator "like '%a%'" SQLite won't use an > Index. > Is this the case? The '%' at the beginning of that operand indicates that the first character of the string can be anything. An index is of no use if you don't know what

Re: [sqlite] Inner Join Performance Issue

2009-10-22 Thread Ralf
gt; boun...@sqlite.org] Im Auftrag von John Crenshaw > Gesendet: Donnerstag, 22. Oktober 2009 05:53 > An: General Discussion of SQLite Database > Betreff: Re: [sqlite] Inner Join Performance Issue > > Try to EXPLAIN the query and verify that the index is actually used. > There ar

Re: [sqlite] Inner Join Performance Issue

2009-10-21 Thread John Crenshaw
, October 21, 2009 5:50 PM To: 'General Discussion of SQLite Database' Subject: [sqlite] Inner Join Performance Issue Hello Forum, [>> ] I have a select that joins 15 Tables the where clause consist of 8 like relations (all fields are indexed), this is to implement a sort of &quo

[sqlite] Inner Join Performance Issue

2009-10-21 Thread Ralf
Hello Forum, [>> ] I have a select that joins 15 Tables the where clause consist of 8 like relations (all fields are indexed), this is to implement a sort of "search engine". The performance is awful. It takes around 10sec. Is this how it should be or is there anything I can do? If you need more

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Igor Tandetnik
Cnichols wrote: > Igor Tandetnik wrote: >> >> Cnichols wrote: >>> Ok I also tried to think about it from a different approached and >>> didnt get the result I wanted ... >>> >>> SELECT COUNT() FROM Temp >>> WHERE Id IN (SELECT QuestionId FROM Stats WHERE SessionId = 7) >>> >>> I expected that to

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Cnichols
Thanks you for all your help! FMI: Is it possible for it to return not distinct pairs also? Thanks again! Igor Tandetnik wrote: > > Cnichols wrote: >> Ok I also tried to think about it from a different approached and >> didnt get the result I wanted ... >> >> SELECT COUNT() FROM Temp >> WHERE

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Igor Tandetnik
Cnichols wrote: > The following produces 52 results, which consists of 52 questions > that where incorrect from session 6, the previous session, we are now > in a new session, session 7 > > SELECT COUNT() FROM Questions Q > LEFT JOIN Stats S ON S.QuestionId = Q.Id > WHERE S.SessionId = 6 > AND S.C

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Igor Tandetnik
Cnichols wrote: > Ok I also tried to think about it from a different approached and > didnt get the result I wanted ... > > SELECT COUNT() FROM Temp > WHERE Id IN (SELECT QuestionId FROM Stats WHERE SessionId = 7) > > I expected that to return 46 results .. it returned 29? ... also kind > of confu

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Igor Tandetnik
Cnichols wrote: > Igor Tandetnik wrote: >> >> "Cnichols" wrote >> in message news:21685825.p...@talk.nabble.com >>> Stats does contain 46 qids with sids of 7 >>> there is one duplicate question now that i look harder in temp which >>> is ok because 289 I forgot to mention that id in temp is not a

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Cnichols
I am trying to keep my thoughts as organized as possible. I want to refresh and try to simplify my question ... The following produces 52 results, which consists of 52 questions that where incorrect from session 6, the previous session, we are now in a new session, session 7 SELECT COUNT() FROM

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Cnichols
Ok I also tried to think about it from a different approached and didnt get the result I wanted ... SELECT COUNT() FROM Temp WHERE Id IN (SELECT QuestionId FROM Stats WHERE SessionId = 7) I expected that to return 46 results .. it returned 29? ... also kind of confusing What I was thinking that

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Cnichols
I expected it to return 46 results, not fewer as you mentioned, except it returns 51 which I am trying to figure out why ... there is only one duplicate in Temp, but why would that still produce more results then 46? Igor Tandetnik wrote: > > "Cnichols" wrote > in message news:21685825.p...@tal

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Igor Tandetnik
"Cnichols" wrote in message news:21685825.p...@talk.nabble.com > Stats does contain 46 qids with sids of 7 > there is one duplicate question now that i look harder in temp which > is ok because 289 I forgot to mention that id in temp is not a key, > this is because there is a test mode to ask rand

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-27 Thread Cnichols
Thanks for the reply. Stats does contain 46 qids with sids of 7 there is one duplicate question now that i look harder in temp which is ok because 289 I forgot to mention that id in temp is not a key, this is because there is a test mode to ask random questions that aren't unique (so 289 was aske

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-26 Thread Igor Tandetnik
"Cnichols" wrote in message news:21676221.p...@talk.nabble.com > What i am trying to do right now is select the questions that have > been asked for the current session (ie 7) > Stats - contains 46 rows with sessionid of 7 > Temp - holds 52 missed questions from the previous session (6) > > exampl

Re: [sqlite] INNER JOIN, JOIN Confusin

2009-01-26 Thread John Machin
On 27/01/2009 12:00 PM, Cnichols wrote: > I have stumped myself with this sql goal. > > With this statement I am working with 3 tables > Stats - contains question asked history and if it was answered correcty > sessionid > questionid > correct > Questions - contains a list questions and mul

[sqlite] INNER JOIN, JOIN Confusin

2009-01-26 Thread Cnichols
I have stumped myself with this sql goal. With this statement I am working with 3 tables Stats - contains question asked history and if it was answered correcty sessionid questionid correct Questions - contains a list questions and mul choice answers and answer id - pk . et

[sqlite] inner join

2007-07-16 Thread Andre du Plessis
I would like to be able to accomplish the following but don't see any support for inner joins on update queries. update A set Id = B.Id from A inner join B on A.Field1 = B.Field_Temp where B.Price > 0 Is this possible? What is the syntax of this query please?

Re: [sqlite] Inner join problem

2004-03-09 Thread Simon Berthiaume
I once posted about that on this mailing list and one of the solution Mr DRH suggested was to auto-expand the table name ( would become SELECT * FROM ) internaly in the SQLite API, but I have no idea if any efforts were put in that direction since it could probably break the old syntax. Ce fut un

Re: [sqlite] Inner join problem

2004-03-09 Thread Guillermo Fernandez Castellanos
Sweet... works right perfect. Can it be considered as a bug? Merci beaucoup! Guille Simon Berthiaume wrote: I think I know what the problem is. SQLite doesn't like having a table name following an openint parenthesis "(" in the FROM clause. Try the following statements instead: SELECT main.id,

Re: [sqlite] Inner join problem

2004-03-09 Thread Simon Berthiaume
I think I know what the problem is. SQLite doesn't like having a table name following an openint parenthesis "(" in the FROM clause. Try the following statements instead: SELECT main.id, prim.primname, sec.secname FROM main INNER JOIN sec ON main.se

[sqlite] Inner join problem

2004-03-09 Thread Guillermo Fernandez Castellanos
Hi, I've had problems with inner join transactions. Here is what I do: I create the tables: sqlite> create table main ( ...> id integer primary key, ...> primid int(10), ...> secid int(10) ...> ); sqlite> sqlite> create table prim ( ...> primid integer primary key, ...> primnam