Bonjour,
Sur ma requete "UNION" je n'ai pas le resultat voulu, il me double les lignes meme si les deux conditions sont remplis alors que je ne devrais avoir q'une ligne:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
facture	DateCompt	Date Reglt
149249	07/01/2009	25/03/2009
149249	07/01/2009	NULL
je n'arrive pas a comprendre mon erreur, voici le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Merci pour votre aide