SQLite newbie question

Discussion in 'Chit Chat' started by JamesC, Jul 24, 2008.

  1. JamesC

    JamesC Member Licensed User

    I am using an SQLite database to store chess game data from a pgn file. I have a table ("Gamestable") in which each record stores data for one game. The data includes "Event", the "Eventdate" and the name of the "White" player. I wish to summarise the table by unique event (that is event||eventdate), giving for each unique event the number of different white players and the number of games.

    The way I have managed to do this is by creating two temporary tables to find the number of players for each event. The code looks something like this:

    It works, but I'm sure there's a much better and faster way of doing it.

    Any suggestions would be appreciated!

    Thanks

    James
     
    Last edited: Jul 24, 2008
  2. JamesC

    JamesC Member Licensed User

    Problem Solved

    The rather simple solution is to use the DISTINCT keyword. The original SQL can be replaced with:

    Useful to know, and about 100 times faster! :sign0188:

    James
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice