Advertisement
Alexbr_95

Untitled

May 9th, 2022
4,732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.26 KB | None | 0 0
  1. SELECT
  2.     c.Affiliation 'Association',
  3.     COUNT(p.IdClientPolicy) 'Active Policies',
  4.     SUM(p.BilledPremium) 'Total Premium'
  5. FROM Client c
  6. INNER JOIN ClientPolicy p ON p.IdClient = c.IdClient AND p.IdStatus = 12 AND p.IdInsurance IN (1945, 1032)
  7. GROUP BY c.Affiliation
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement