Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE @Noeud int
- DECLARE @DateFinPeriode datetime
- SET @DateFinPeriode = '23/02/2010 15:32'
- select * from Agent ag WHERE ag.DateCreation < @DateFinPeriode AND (ag.DateInactif > @DateFinPeriode OR ag.DateInactif IS NULL)
- SET @Noeud = 1
- WITH RechNoeud(PK_Noeud,FK_NoeudParent)
- AS (
- SELECT n.PK_Noeud,n.FK_NoeudParent
- FROM Noeud n
- WHERE n.PK_Noeud = @Noeud
- UNION ALL
- SELECT n.PK_Noeud,n.FK_NoeudParent
- FROM Noeud n
- INNER JOIN RechNoeud r ON n.FK_NoeudParent = r.PK_Noeud
- )
- SELECT *
- FROM Agent ag
- INNER JOIN RechNoeud r ON (r.PK_Noeud = ag.FK_Noeud)
- WHERE ag.DateCreation < @DateFinPeriode AND (ag.DateInactif > @DateFinPeriode OR ag.DateInactif IS NULL)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement