sql - Retrieve count of related records -
I currently have two tables in my data source that I am referring to in this example first, to explain the context For, I have VB There is a Windows Project Program in Net (Visual Studio 2013).
In the first table trainer, I have the following fields: ID, first name, surname, contact, class.
Members in the second table, I have the following fields: ID, first name, surname, contact, type, trainer id.
I have implemented the reinforced integrity between the two trainers. ID is used as PK and member. Trainee as an FM with 1: m relationship. I am trying to retrieve the number of records related to the trainer's specified ID. I want to retrieve the number of related records, for example, by clicking on the search I provide Trainer ID, I would like to return the amount of those customers to whom it belongs.
I need this, so that I can work commission + Find my salary on the basis of the base amount. I've seen a lot, have read a lot but I can not get it. Any help would be appreciated.
If you have a trainer ID, then you can not:
Select cnt from the member number (*) Select where m.trainerid = @TheTrainerId;
Comments
Post a Comment