Retrieving Speed and Official Rating

+1 vote
Hi Guys,

Why do I keep getting a problem when trying to retrieve speed and official rating? Even when I try 'official_rating.daily_races' in the middle of the script I get a problem.

Thanks
asked Mar 12, 2012 in Smartform by arkantosno1 Novice (220 points)

1 Answer

0 votes

Hi - See your query with official rating and speed rating added in the comments below.

Essentially, you need to add the database table name first rather than second when trying to select an individual data field that exists in different tables, as in:

>historic_runners.speed_rating

and

>historic_runners.official_rating

Hope this helps

Colin

answered Mar 13, 2012 by colin Frankel (19,320 points)
edited Mar 17, 2012 by colin
SELECT round(starting_price_decimal, 0), round(forecast_price_decimal, 0),
round(prize_money, -2), ascii(gender), round(distance_yards),
position_in_betting, finish_position FROM historic_races join historic_runners
using (race_id) where course="wolverhampton" and handicap="0" and all_weather=1 and stall_number between 1 and 20
and age >2 and race_type= "all weather flat" and days_since_ran between 1 and 1000 and class= 5 and finish_position=1
and starting_price_decimal between .1 and 1000 and forecast_price_decimal between .1 and 1000
and prize_money between 1 and 5000
and finish_position between 0 and 25
order by finish_position ASC



The asci(gender) is because I needed an integer instead of letters and didnt know how to convert them in any other way.

Thanks
Hi - here's your query with official rating and historic rating added:
SELECT round(starting_price_decimal, 0) AS 'SP_dec', round(forecast_price_decimal, 0) AS 'SP_forecast', round(prize_money, -2) AS 'Prize Money', ascii(gender) AS 'gender', round(distance_yards) AS 'distance', position_in_betting, finish_position, historic_runners.official_rating AS 'OR', historic_runners.speed_rating AS 'SR' FROM historic_races join historic_runners using (race_id) where course="wolverhampton" and handicap="0" and all_weather=1 and stall_number between 1 and 20 and age >2 and race_type= "all weather flat" and days_since_ran between 1 and 1000 and class= 5 and finish_position=1 and starting_price_decimal between .1 and 1000 and forecast_price_decimal between .1 and 1000 and prize_money between 1 and 5000 and finish_position between 0 and 25 order by finish_position ASC;
Thanks very much, very much appreciated.
...