I am developping a simple criminal records management system using SQL Server.
I have the following tables:
Criminal (
CriminalID,
Gender ...)
Victim (
VictimID,
Gender ...)
Crime(
CrimeID,
CriminalID,
VictimID ...)
I am interested in creating a view that gives us a simple statistic about Gender of victims by gender of criminals.
Example of wanted output:
Victim \ Criminal | Male | Female
Male | 4 | 2
Female | 8 | 5
Grouping the Number of crimes only by gender of victims or only by gender of criminals isnt hard , But how can i perform this task ? How to Expand the Gender of criminals into 2 separate columns and perform the needed task ?