| 
  
	
    	    JCapper Message Board 
            
                       JCapper 101 
                                     --
                SQL Mode - distance cut-backs, stretch-outs, and surface changes 
   | 
  
     
   | 
  
 
  
  | By | 
   SQL Mode - distance cut-backs, stretch-outs, and surface changes  | 
  
 
jeff 12/7/2011 12:31:52 PM |  --quote:"Hi Jeff, I can use some help for writing the appropriate sql expressions for excluding stretchouts and turnbacks as well as excluding turf-to-dirt & dirt-to-turf  from trainer queries.
  Thanks, HK FL " --end quote
 
 
  Link to table schema doc: http://www.jcapper.com/helpdocs/starterhistorytableschema.html
    Distance - there are 2 fields for distance in the table schema:  
  DIST - number single distance in yards today’s race   
  DISTLASTOUT - number single distance in yards most recent start 
   
  Cutback route to sprint: 
  AND STARTSLIFETIME > 0   AND DIST < 1760 AND DISTLASTOUT >= 1760 
  
  Stretchout sprint to route:
  AND STARTSLIFETIME > 0   AND DIST >= 1760 AND DISTLASTOUT < 1760 
  
  To avoid turf to dirt, use surface shift (SFSHIFT) as follows: 
  AND NOT (SFSHIFT BETWEEN 4 AND 7)
 
  To avoid dirt to turf, use surface shift (SFSHIFT) as follows:
  AND NOT (SFSHIFT BETWEEN 8 AND 11)
   
  Note: In the above lines for SFSHIFT, placement of the parenthesis characters is important.
 
  Hope I managed to answer your question.
  -jp
 
  .
 
 
  |  
     
 
  
   
   |