SQL Crosstab not showing correct counts
I am trying to create a crosstab that gives me a count of crash type by injury severity, and the data is in three tables (crashes, occupants & pedestrians). The occupants & pedestrians tables have a many-to-one relationship with crashes since there is typically more than one person involved in a crash. I made a view to handle assigning the crash severity to each crash_id based on the occupants and pedestrians tables. Now when I run the query below, the total count is correct, but the counts in each category are not always correct.