>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?
select Master.*, step1.CountChildren from Master ;
inner join ;
(select MasterID, count(*) as CountChildren from Child group by masterID) step1 ;
on Master.MasterID = step1.MasterID
If it's not broken, fix it until it is.
My Blog