Thanks Igor. Can i get custom results like GamesWonByPlayer1
By using getColumn in the normal way? That may be a stupid question - I guess what I mean is, are those custom identifiers treated as column names when reading back from the select? Thanks, Ian On 16/11/2010 13:04, Igor Tandetnik wrote: > Ian Hardingham<i...@omroth.com> wrote: >> I have a badly designed structure for a table which records /games >> played/ by people. It looks like: >> >> id >> player1 >> player2 >> score >> >> If score> 0, player 1 won the game. If score< 0, player 2 won it. >> (Score of 0 is a draw). >> >> I wish to find the total record in games between two specific players. >> It seems to me that I would like to do the following: >> >> Select all games between the two players >> take a count of this >> Select from within the first select all games won by a certain player > I'm not quite sure what you are trying to achieve, but see if this helps, at > least as a starting point: > > select > count(*) TotalGames, > sum(score> 0) GamesWonByPlayer1, > sum(score< 0) GamesWonByPlayer2, > sum(score = 0) Draws > from Games where player1 = ? and player2 = ?; > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users