View Single Post
  #9 (permalink)  
Old 10-29-09, 12:08
BettingSherlock BettingSherlock is offline
Registered User
 
Join Date: May 2007
Posts: 78
So the ANSI SQL equivalent would be:
delete from racerunnerUK where (race_id || ',' || horse_id) IN ('84931,100401','84931,97256','84931,96156','84931 ,14021');

I know the concatenation is awkward and i'm just doing that to keep the filesize of the scripts down. This table has over 1 million records. The biggest script contains data on 1 year and that can exceed 150000 records. So even though the syntax is awkward it does result in a lot smaller files. If it doesn't work as ANSI SQL then i can always swich to the syntax like you suggest.

There are other tables as well but this one is the only one with a combined primary key.


CREATE TABLE `sbs_racingdb`.`racerunneruk` (
`HORSE_ID` mediumint(1) unsigned NOT NULL,
`RACE_ID` mediumint(1) unsigned NOT NULL COMMENT 'Unique ID for a race specific to SBS',
`runnerstatus` varchar(25) default NULL COMMENT 'Entry, Non-runner, Runner',
`Entry` tinyint(3) unsigned default NULL,
`Draw` tinyint(3) unsigned default NULL,
`Position` tinyint(3) unsigned default NULL,
`tempDistance` varchar(255) default NULL,
`AGE` tinyint(2) unsigned default NULL COMMENT 'Age of horse at time of race, could be replaced when horses date of birth is known.',
`STONE_WEIGHT` tinyint(2) unsigned default NULL COMMENT 'First part of weight, STONE.',
`POUND_WEIGHT` tinyint(2) unsigned default NULL COMMENT 'Second part of weight, POUNDS.',
`TEMP_HEADGEAR` varchar(10) default NULL COMMENT 'To be examined at a later stage.',
`RATING` tinyint(2) unsigned default NULL COMMENT 'Official rating. Max.nr. found so far 148',
`SP1` smallint(6) default NULL COMMENT 'First part of SP price.',
`SP2` smallint(6) default NULL COMMENT 'Second part of SP price.',
`FC1` smallint(6) unsigned default NULL,
`FC2` smallint(6) unsigned default NULL,
`REPORT` text COMMENT 'Report on horses performance. longest report found 833 characters',
`TEMP_BETTING` varchar(20) default NULL COMMENT 'Early prices published by Sportinglife, to be examined at a later stage.',
`JOCKEY_ID` mediumint(1) unsigned default NULL,
`JOCKEYALLOWANCE` tinyint(2) unsigned default NULL COMMENT 'Weight in pounds(?)',
`TRAINER_ID` mediumint(1) unsigned default NULL,
`TEMP_SP_REMARK` varchar(2) default NULL COMMENT 'Indicated if horse was favourite, to be examined at a later stage.',
`TEMP_LTOCDWBF` varchar(255) default NULL COMMENT 'Notes for horse, to be examined at a later stage.',
`TEMP_FORM` varchar(10) default NULL COMMENT 'Result for horse in last races, to be replaced by own query.',
PRIMARY KEY (`RACE_ID`,`HORSE_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Horses participating in a race.';
Reply With Quote