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
| select
t.facture,
t.DateCompt,
t.DateReglt
from
(
select
T1.[Document No_ ] as facture,
convert(char(10),T1.[Posting Date],103) as DateCompt,
convert(char(10),T2.[Posting Date],103) as DateReglt
from
[SOCIETE$Cust_ Ledger Entry] T1,
[SOCIETE$Cust_ Ledger Entry] T2
where
T1.[Posting Date] between '01/01/09' and '31/01/09'
and T1.[Document No_ ] = T2.[Applies-to Doc_ No_]
and T1.[Document Type] = '2'
union all
SELECT
No_ "Facture",
convert(char(10),[Posting Date],103) as DateCompt,
null as DateReglt
FROM
[SOCIETE$Sales Invoice Header]
WHERE
[Posting Date] BETWEEN '01/01/09'and '31/01/09'
AND [Facture Acompte]<>1
)t
order by t.facture |