>Given the following:
>
>- Each department can have multiple users.
>- Each user can have multiple departments.
> -A letter belongs to a user and a department
>
>How would you write a stored procedure that takes a UserID and returns all of the columns from the
>Department and Letter tables for each Letter for the UserID that was passed to the stored procedure?
>
>I'm not sure how to code this with the many-to-many relationship between Departments and Letters.
SELECT *
FROM Users
INNER JOIN Departments ON Departments.UserId = Users.Id
INNER JOIN Letters ON Letters.UserId = Users.Id
WHERE Users.Id = @UserId
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.