Re: [sqlite] Query critique

2010-10-18 Thread Ian Hardingham
Thanks Simon. I have a further question on this topic. I would like to find out where my user ranks amongst all scores - so I want to SELECT name, score FROM scoreTable WHERE id=x And then I wish to know how many rows occur before the one where user=myuser. I can loop through them in code,

Re: [sqlite] Query critique

2010-10-18 Thread Simon Slavin
On 18 Oct 2010, at 4:09pm, Ian Hardingham wrote: > I also want to add selecting the highest score, and adding it to the > results assuming it isn't already in there (ie unless it happens your or > a friends' score is the highest). Could anyone advise me on how best to > do that? Can you not

[sqlite] Query critique

2010-10-18 Thread Ian Hardingham
Hey guys. I'm kind of revisiting something I asked about before. I have a high scores table, and a table of friends, and I wish to select for user x: The score of x The scores of all of x's friends Ordered by score descending. I am using this: SELECT * FROM (SELECT * FROM cupPlayTable

Re: [sqlite] Query critique

2010-07-10 Thread Virgilio Alexandre Fornazin
sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Roger Binns Sent: sábado, 10 de julho de 2010 17:39 To: General Discussion of SQLite Database Subject: Re: [sqlite] Query critique -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/09/2010 01:54 AM, Ian Hardingham wrote: > And her

Re: [sqlite] Query critique

2010-07-10 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/09/2010 01:54 AM, Ian Hardingham wrote: > And here is my query (written in a script language): Are you actually getting correct answers from this? > upper('?') Unless your script language includes a SQL parser, that does not do what you

[sqlite] Query critique

2010-07-10 Thread Ian Hardingham
Hey guys. I have a query which is very slow, and was wondering if there was any advice you guys had on it. Here are two table definitions: CREATE TABLE IF NOT EXISTS globalRankingTable (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL UNIQUE, ranking TEXT, score REAL, record TEXT);

Re: [sqlite] Query critique

2010-07-09 Thread Tim Romano
If you had the following tables Table PEOPLERANKINGS(personid INTEGER PRIMARY KEY, personname TEXT, ranking) Table FRIENDS(personid1, personid2) and an index on PEOPLERANKINGS.ranking and FRIENDS.personid1,FRIENDS.personid2 is a composite unique primary key You could get the top 10

Re: [sqlite] Query critique

2010-07-09 Thread Benoit Mortgat
On Fri, Jul 9, 2010 at 11:08, Ian Hardingham wrote: > Hey guys. > > I have a query which is very slow, and was wondering if there was any > advice you guys had on it. > > Here are two table definitions: > > CREATE TABLE IF NOT EXISTS globalRankingTable (id INTEGER PRIMARY KEY >

[sqlite] Query critique

2010-07-09 Thread Ian Hardingham
Hey guys. I have a query which is very slow, and was wondering if there was any advice you guys had on it. Here are two table definitions: CREATE TABLE IF NOT EXISTS globalRankingTable (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL UNIQUE, ranking TEXT, score REAL, record TEXT);