jeff 7/31/2022 12:58:24 PM | Trainer is the sole owner
The first case is where the names of both trainer and owner in The Jockey Club's registry are identical.
This case is easy. Just use something like this in a sql expression:
AND TRAINER = OWNER
Trainer owns shares of the horse as part of a partnership
This case is a bit more complicated because the text in the TRAINER and OWNER fields of the StarterHistory table are not an exact match.
Instead TRAINER and OWNER fields are a partial match.
Quite often, the trainer's last name or sometimes last name and initials, can be found somewhere in the name of the partnership listed in the OWNER field.
This makes things more complicated from a sql expression standpoint.
It took me a bit of thinking to come up with a working sql expression that will get you about 90 percent of the way there.
Before illustrating the sql expression itself, it might be a good idea to point out how trainer names in the TRAINER field of a JCapper StarterHistory table are structured.
The basic format using HDW data with the CXN Names Formatting Enhanced Setting set to 0 Remove Punctuation Characters is "LASTNAME FIRSTNAME MIDDLE SUFFIX" (with each if present separated by a space and without the quote characters.)
Example, without the quote characters:
"SAFFIE JOSEPH JR"
In the sql expression below, I'm using the INSTR command to match the OWNER field against the first group of characters (I'm guessing that 98 plus percent of the time this will be the trainer's last name) in the TRAINER field.
This is the sql expression I came up with:
select distinct trainer, owner, horsename, [date], track, race from starterhistory where instr(owner, left(trainer, instr(trainer, ' '))) > 0 and [date] >= #11-01-2021# and [date] <= #07-30-2022# order by trainer
I executed the above sql expression in the JCX File Exports Module and generated a .csv file containing a list of trainers and owners with horsename, date, track, and race where the trainer last name appears as part of a partnership in the OWNER field of my current Starterhistory table.
From there I opened the .csv file in Excel, expanded the columns to make the data visible to the human eye, and then re-saved it as an .xslx worksheet.
After that I zipped up both files and uploaded the .zip file to the JCapper server where you can download it.
Link to the .zip file: here.
Feel free to save the .zip file to your hard drive, extract the .csv and xlsx files, and from there double click either file to open in Excel and take a look at the data.
From here, you'll likely need to do some further research on your own.
Specifically, you may need to weed out partnerships where one of the partners just happens to have the same last name of the trainer, but who wasn't the trainer of record for that horse on the day of the race.
To that end, I included horsename, date, track, and race in hopes that the additional info might make things easier for anyone wanting to root bad names that may or may not exist in the above mentioned files.
Also, it's possible at least some of the trainer last name combinations involve father/son, father/daughter, brother/brother, and brother/sister, etc.
I hope I managed to type most of that out in a way that makes sense.
-jp
.
|