ADS SQL- Aggregate functions and subqueries -
currently using advantage sql database , wanting produce "summary" report. lets have people referred in month , either started on programme or didn't.
i query return total number of customers referred month column stating how many of these started us. below gives me last column want (a count how many started). "started" field in trainee table.
select f.name, cast(year(j.refdate) sql_varchar(4)) + '-' + cast(month(j.refdate) sql_char(2)), count(t.ident) trainee t join pcfndorg f on f.fundorg = t.fundorg join pcptwepi j on j.ident = t.ident j.ponum not null group f.name, cast(year(j.refdate) sql_varchar(4)) + '-' + cast(month(j.refdate) sql_char(2))
Comments
Post a Comment