-4
SELECT r.region_name as Region,
       COUNT(o.*) AS CanCount
FROM region AS r
INNER JOIN orders AS o ON o.region_id = r.region_id
WHERE r.region_id = 1

SELECT [Region] = r.region_name
     , [CanCount] = COUNT(o.*)
FROM region AS r
INNER JOIN orders AS o ON o.region_id = r.region_id
                      AND r.region_id = 1

1 Answers1

0

The results would be the same.

In the second query you're stating that you only want results to join the two tables if 'region id' = 1. This would imply that only the 'region ID' field only joins the two tables if they have a matching output of 1.

In the first query you are requesting the results to only return values if the 'region id' is = 1. The join in the first query will bring back all of the 'region ID' field if they match and filter out for the value of 1 in the output.

cbrown92
  • 13
  • 4