View Single Post
  #2 (permalink)  
Old 08-01-2008, 08:26 AM
JamesC JamesC is offline
Junior Member
 
Join Date: Mar 2008
Location: Thailand
Posts: 46
Smile Problem Solved

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

Quote:
CREATE TABLE summaryevents (Event CHAR(20), NrPlayers SMALLINT, NrGames SMALLINT, EventDate CHAR(10), Qevent CHAR(30))

INSERT INTO summaryevents (Event, NrPlayers, NrGames, EventDate, Qevent) Select Event, Count(DISTINCT White) as NrP, count() as NrGames, EventDate, Event||Eventdate As Qevent from Gamestable group by Qevent
Useful to know, and about 100 times faster!

James
Reply With Quote