Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Test Question
Message
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Titre:
Divers
Thread ID:
01454773
Message ID:
01454775
Vues:
54
It may help if you post create table statements and some input. Desired output will help as well.

>Show 3 different ways to do the following:
>
>
>- Each department can have multiple users.
>- Each user can have multiple departments.
>- A letter belongs to a user and a department.
>
>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.
>
>Here's one way that I came up with:
>
>
>
>CREATE PROCEDURE GetDeptLetters
>	@UserId		INT
>
>AS
>
>	SELECT d.*, l.*
>		FROM Departments d
>		JOIN Letters l ON l.DepartmentId = d.DepartmentId AND l.UserId = @UserId
>		WHERE d.DepartmentId = @UserId
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform