SELECT runner_mr.RunnerName AS Starts,
result_mr.`1st` AS Wins,
runner_mr.Scratched AS Scratchings
FROM result_mr RIGHT OUTER JOIN runner_mr ON result_mr.`1st` = runner_mr.RunnerName AND runner_mr.MtgId = result_mr.MtgId
WHERE runner_mr.RunnerName = "TESTASCANA"
i would ultimately like to ...
COUNT(runner_mr.RunnerName) AS Starts,
COUNT(result_mr.`1st`) AS Wins,
COUNT(runner_mr.Scratched) AS Scratchings [where scratched = "Y"]
no you cnat have where in your select. the whole point of the query is that you tell it what to select and from where and what are the conditions. its pretty logical-if your scratched=y in a few of the records what should the sql do with the others? If that has to be a single query you have a few options really:
union(that usually takes a lot of time to process)
or use joins-you can join a table on itself. depending on your case it would be left join or right join. personally ive never had to use right join and to be honest i dont think i know anyone that ever has. here is a decent guide on what they are and what are the differences: Difference between left join and right join | PHP F(n)