Re: [sqlite] Optimise select from attached databases

2009-09-28 Thread Andrew Gatt
P Kishor wrote: > On Mon, Sep 28, 2009 at 12:06 PM, Andrew Gatt wrote: > >> I'm trying to optimise a select statement, but from multiple attached >> databases. The general statement would be; >> >> SELECT * FROM database0.table WHERE id = 1; >> >&

[sqlite] Optimise select from attached databases

2009-09-28 Thread Andrew Gatt
I'm trying to optimise a select statement, but from multiple attached databases. The general statement would be; SELECT * FROM database0.table WHERE id = 1; Where i have a long list of ids to retrieve, which could be from any of the attached databases. With a single database i would prepare the s

Re: [sqlite] Table Exists Query

2009-08-15 Thread Andrew Gatt
Simon Slavin wrote: > On 15 Aug 2009, at 3:12pm, Andrew Gatt wrote: > > >> but by my scheme you can't be sure if the list_1 table exists in >> database2, >> > > Add a column to your 'lists' tables which says which database they're &

Re: [sqlite] Table Exists Query

2009-08-15 Thread Andrew Gatt
Roger Andersson wrote: > > I have multiple databases, both have a table called "lists" inside this > table is the names of other tables in the database that make up the lists. > Each individual list is made up of the tables that have the same name in > each database (the list is split between diffe

[sqlite] Table Exists Query

2009-08-15 Thread Andrew Gatt
Hi all, I have multiple databases, both have a table called "lists" inside this table is the names of other tables in the database that make up the lists. Each individual list is made up of the tables that have the same name in each database (the list is split between different storage devices in

Re: [sqlite] Temporary Table Speed Up Select

2008-10-28 Thread Andrew Gatt
Thomas Briggs wrote: >How much slower is the index than your pre-populated table? If > you're really comparing apples to apples it would be good to know how > big the different is. > >If you post your schema and queries you'll probably get better > advice. At that this I'm just guessing.

Re: [sqlite] Temporary Table Speed Up Select

2008-10-28 Thread Andrew Gatt
Thomas Briggs wrote: >Ultimately it'll depend on your schema and the query you're > running, but you're probably better off creating an index that covers > the SELECT query you're executing. That should make the query fast > and save you the hassle of writing and maintaining triggers. > >T

[sqlite] Temporary Table Speed Up Select

2008-10-27 Thread Andrew Gatt
My program uses a relatively slow select statement to get the rows the program needs. This is done very often, but updates, inserts and deletes are done very infrequently. My idea was to create a temporary table with the result of this select statement, then create triggers from the main table

Re: [sqlite] Multiple Selects

2008-10-19 Thread Andrew Gatt
MikeW wrote: > Andrew Gatt <[EMAIL PROTECTED]> writes: > > >> I'm not sure if i'm missing something, but is there an efficient way of >> retrieving multiple rows based on different conditions in order. For >> example i have a table with rows of i

Re: [sqlite] Multiple Selects

2008-10-18 Thread Andrew Gatt
just ordered. I.e. i may want row 45 first, then 32 then 67 etc... > On Sat, Oct 18, 2008 at 6:53 PM, Andrew Gatt <[EMAIL PROTECTED]> wrote: > >> Andrew Gatt wrote: >> >>> I'm not sure if i'm missing something, but is there an efficient wa

Re: [sqlite] Multiple Selects

2008-10-18 Thread Andrew Gatt
Andrew Gatt wrote: > I'm not sure if i'm missing something, but is there an efficient way of > retrieving multiple rows based on different conditions in order. For > example i have a table with rows of ids, i want to select multiple rows > at a time. At present i am doi

[sqlite] Multiple Selects

2008-10-18 Thread Andrew Gatt
I'm not sure if i'm missing something, but is there an efficient way of retrieving multiple rows based on different conditions in order. For example i have a table with rows of ids, i want to select multiple rows at a time. At present i am doing a "SELECT name FROM table WHERE id = x" for each

Re: [sqlite] Ignoring "The"

2008-07-23 Thread Andrew Gatt
Dennis Cote wrote: > Andrew Gatt wrote: > >> Error: wrong number of arguments to function substr() >> >> I'm using sqlite 3.3.6, but i'm presuming the two and three variable >> substr functions go back further than this? Doing tests it seems to be >

Re: [sqlite] Ignoring "The"

2008-07-23 Thread Andrew Gatt
Dennis Cote wrote: > Andrew Gatt wrote: > >> I have a table of music artist names which i'd like to output in order. >> Normally i just use: >> >> select * from artists order by artist_name; >> >> What i'd really like to do is order

Re: [sqlite] Ignoring "The"

2008-07-23 Thread Andrew Gatt
>> I have a table of music artist names which i'd like to output in order. >> Normally i just use: >> >> select * from artists order by artist_name; >> >> What i'd really like to do is order the artists by name but ignore any >> "the" or "the," preceding it. >> >> Any ideas? >> >> Thanks >> >> A

[sqlite] Ignoring "The"

2008-07-23 Thread Andrew Gatt
I have a table of music artist names which i'd like to output in order. Normally i just use: select * from artists order by artist_name; What i'd really like to do is order the artists by name but ignore any "the" or "the," preceding it. Any ideas? Thanks Andrew _

Re: [sqlite] Results even if no rows

2006-07-13 Thread andrew gatt
> "andrew gatt" <[EMAIL PROTECTED]> writes: > > > I'm trying to come up with an SQL statement that works under sqlite that can > > return a list of rows depending if a list of ids exist. For individual > > checking i'm using: > > > > s

[sqlite] Results even if no rows

2006-07-13 Thread andrew gatt
Hi all, I'm trying to come up with an SQL statement that works under sqlite that can return a list of rows depending if a list of ids exist. For individual checking i'm using: select 1 from table where id == 1; which returns a 1 if there is a row or no rows if it doesn't exist. However i have

Re: [sqlite] Count and Display

2006-06-22 Thread andrew gatt
ECTED]> To: Sent: Thursday, June 22, 2006 5:42 PM Subject: Re: [sqlite] Count and Display > andrew gatt wrote: > > I'm trying to work out the most efficient way of performing a query. > > What i want is for the rest of the database starting at a certain letter, and ordered

[sqlite] Count and Display

2006-06-22 Thread andrew gatt
I'm trying to work out the most efficient way of performing a query. What i want is for the rest of the database starting at a certain letter, and ordered alphabetically. So for example this command: SELECT name FROM people WHERE name > 'C%' ORDER BY people however i need to apply a limit and m

RE: [sqlite] ATTACH, query and differentiate

2005-08-04 Thread Andrew Gatt
>>Donald, >> >>Thanks for your reply, its all a bit new to me, so i'm still trying to get my >>head round it and hopefully be able to explain myself better. >> >>I'm actually creating the unique ids, it is just a number. >> >>I now think my understanding of an attached database is wrong, my first

RE: [sqlite] ATTACH, query and differentiate

2005-08-04 Thread Andrew Gatt
e ATTACH documentation which may be helpful: http://www.sqlite.org/lang_attach.html Donald Griggs Opinions are not necessarily those of Misys Healthcare Systems nor its board of directors. -Original Message- From: Andrew Gatt [mailto:[EMAIL PROTECTED] Sent: Thursday, August 04, 2005 6:56 AM To: sqlite-users@sqlite.org Subject: [sqlite] ATTACH, query and differentiate

[sqlite] ATTACH, query and differentiate

2005-08-04 Thread Andrew Gatt
Hi, I'm not sure if what i am trying to acheive is possible, but if i explain what i'm trying to do someone may be able to point me in the right direction. I have a database table that holds some information, with each entry having a unique id. So when i query the database i can get a list of i