1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| select
T.Date,
T.Jours,
T.Affaire,
T.Perso,
T.Equipe
from
(
select
convert(char(10),T1.[Journée],103) as Date,
T1.[Absence] as Jours,
T1.[Agence Origine] as Affaire,
T1.[Ressource] as Perso,
T1.[Equipe] as Equipe
from dbo.[SOCIETE$Emploi du temps] T1
inner join dbo.[SOCIETE$Filtre Export Paye] T2
on T1.[Ressource] = T2.[Code Resource Associée]
where T2.[Code Ressource] = 'TOTO'
and T1.Absence = '1'
and T1.[Type] = '0'
and T1.[Journée] between '01/08/2010' and '31/08/2010'
--order by [Journée]
union all
select
convert(char(10),T1.[Forecast Date],103) as Date,
cast(T1.[Forecast Quantity (Base)] as float) as Jours,
T1.[Document No_] as Affaire,
T1.[Ressource] as Perso,
T1.[Equipe] as Equipe
from dbo.[SOCIETE$Production Chantier] T1
inner join dbo.[SOCIETE$Filtre Export Paye] T2
on T1.[Ressource] = T2.[Code Resource Associée]
where T2.[Code Ressource] = 'TOTO'
and T1.[No_] = 'PR'
and T1.[Forecast Date] between '01/08/2010' and '31/08/2010'
--order by T1.[Ressource],T1.[Forecast Date]
)T
order by Perso,Date |
Partager