>I have a one to many relationship. From the master table, I am selecting all the records. But, for each record in the SQL result, I need to also include the number of child records. Anyone would have a quit example on how to achieve that?
I think the basic idea is something like this:
select Master.Master, count(*) as HowMany;
from Master join Child on Master.Master = Child.Master;
group by Master;
into cursor Temp
Additional adjustments may be needed if there is the possibility of master records without child records. A left join, for a start.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)