bonjour ,
j'ai crée une requête qui m'affiche des doublons sur le champ ( A.txt_quotefield ) aléatoirement. Comment faire un sous-select pour n'avoir q'une seule ligne.

Merci de bien vouloir m'apporter une aide sur ce petit problème.

sincères salutations.

Ci-joint ci-dessous la requête ainsi qu'un extrait des données sur Excel.


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
30
31
32
33
34
 
Select A.cd_box2, A.cd_box, A.txt_quotefield, A.dt_ws_begin, A.tm_fcast_tech_time, A.tm_maint_stop
From WS A, WO B, WS_PROCESS C, CM_TRIGGER D
 Where B.cd_wo = A.cd_wo
 And A.cd_wo = C.cd_wo
 And A.cd_ws = C.cd_ws
And B.cd_pwo = D.cd_pwo 
And (
 (A.cd_wo>0)
	and (A.cd_ws>0)
	and (A.dttm_validate between to_date(‘01/11/06’,’DD/MM/YY’) and to_date(31/12/06’)
       )
and (A.txt_quotefield not like ‘%Pièces%’)
and ( A.cd_company = ‘CLUS’)
and (A.cd_wows_status =’6)
and (C.txt_quotefield is not null
        and C.txt_quotefield not like ‘%Lien doc externe%’)
and (D.val_nextday between 91 and 1825)
)
order by 1, 2
 
 
Le résultat affiché
 
CD_BOX2	CD_BOX	TXT_QUOTEFIELD
CAGE	A038	A03802S
CAGE	A038	A03802S
CAGE	A038	A03802S
CAGE	A038	A03802S
CAGE	A145	A14501S
CAGE	A208	A20808A
CAGE	A208	A20811S
CAGE	B036	B03602S  PSQ1
CAGE	B036	B03602S  PSQ1