Sql

Fermé
K! - 7 oct. 2003 à 17:12
Nettogrof Messages postés 521 Date d'inscription lundi 29 septembre 2003 Statut Membre Dernière intervention 8 décembre 2005 - 7 oct. 2003 à 18:48
Bonjour,
Voilà j'ai 8 requêtes très semblables mais sur des tables différentes. Je voudrais pouvoir former une seule requête avec ces 8 requêtes. En fait c'est pour pouvoir faire un group by par la suite et les avoir tt bien rangé ds mon fichier de sortie.
Voici mes requêtes:
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crc_v22 a, entete_crc b where a.entite=b.entite ;
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crtpm_v22 a, entete_crtpm b where a.entite=b.entite ;
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crtpp_v22 a, entete_crtpp b where a.entite=b.entite ;
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crdep_v22 a, entete_crdep b where a.entite=b.entite ;
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crder_v22 a, entete_crder b where a.entite=b.entite ;
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crhb_v22 a, entete_crhb b where a.entite=b.entite ;
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crpre_v22 a, entete_crpre b where a.entite=b.entite ;
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crtit_v22 a, entete_crtit b where a.entite=b.entite ;
Help me please!
Merci d'avance
K!
A voir également:

2 réponses

sebsauvage Messages postés 32893 Date d'inscription mercredi 29 août 2001 Statut Modérateur Dernière intervention 21 octobre 2019 15 659
7 oct. 2003 à 17:24
Bon d'accord, c'est bourrin, mais:
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crc_v22 a, entete_crc b where a.entite=b.entite
UNION
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crtpm_v22 a, entete_crtpm b where a.entite=b.entite
UNION
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crtpp_v22 a, entete_crtpp b where a.entite=b.entite 
UNION
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crdep_v22 a, entete_crdep b where a.entite=b.entite
UNION
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crder_v22 a, entete_crder b where a.entite=b.entite 
UNION
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crhb_v22 a, entete_crhb b where a.entite=b.entite 
UNION
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crpre_v22 a, entete_crpre b where a.entite=b.entite 
UNION
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation from crtit_v22 a, entete_crtit b where a.entite=b.entite ;
0
Nettogrof Messages postés 521 Date d'inscription lundi 29 septembre 2003 Statut Membre Dernière intervention 8 décembre 2005 672
7 oct. 2003 à 18:48
ou bein :
select distinct a.entite,b.code_class,a.cd_app2 , b.dtsituation, c.entite,d.code_class,c.cd_app2 , d.dtsituation,e.entite,f.code_class,e.cd_app2 , f.dtsituation,g.entite,h.code_class,g.cd_app2 , h.dtsituation, i.entite,j.code_class,i.cd_app2 , j.dtsituation,k.entite,l.code_class,k.cd_app2 ,l.dtsituation, m.entite,n.code_class,m.cd_app2 ,n.dtsituation,o.entite,p.code_class,o.cd_app2 , p.dtsituation
from  crc_v22 a, entete_crc b, crtpm_v22 c, entete_crtpm d,  crtpp_v22 e, entete_crtpp f,crdep_v22 g, entete_crdep h, crder_v22 i, entete_crder j,  crhb_v22 k, entete_crhb l, crpre_v22 m, entete_crpre n,  crtit_v22 o, entete_crtit p
where   a.entite=b.entite and  c.entite=d.entite and      e.entite=f.entite and  g.entite=h.entite and   i.entite=j.entite and  k.entite=l.entite  and   m.entite=n.entite and    o.entite=p.entite
Group by
   (???)
¨



Espérant que ca va aider..... car c'est assez long

Nettogrof tseb era seiromem emoS
0