Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Custom classifications of business objects
Custom grouping of business objects
8. Custom grouping – exercise
Custom counting of business objects
Summary

Instruction

Good. Let's do one more exercise of this kind.

Exercise

We want to create a simple report that will show the number of young and old employees at Northwind. Show two columns: Age and EmployeeCount.

The Age column has the following values:

  • N'young' for people born after 1 Jan 1980.
  • N'old' for all other employees.

Stuck? Here's a hint!

Use the following condition:

BirthDate > '1980-01-01'

Here's an example of using CASE WHEN:

CASE
  WHEN Country IN (N'USA', N'Canada') THEN N'North America'
  WHEN Country IN (N'Japan', N'Singapore') THEN N'Asia'
  ELSE N'Other'
END AS SupplierContinent