OVH Cloud OVH Cloud

WD9 - pb imbrication de left join

4 réponses
Avatar
Vincent
Bjr,

J'utilise la requete suivante :
select * from
PROSPECT left join origine on PROSPECT.ogcleunik = origine.ogcleunik

Pas de pb.
Maintenant, si je rajoute un left join :

select * from
(PROSPECT left join ORIGINE on PROSPECT.ogcleunik = ORIGINE.ogcleunik)
left join EMPLOYE on EMPLOYE.emcleunik=PROSPECT.emcleunik

J'ai l'erreur "Erreur d'initialisation de la requête, mot PROSPECT
inattendu."

4 réponses

Avatar
Pierre BOUSQUET
j'ai bien peur que ce soit un problème PCSOFT, il vaut mieux oublier les
requetes à plus de deux tables. Je me suis pas mal cassé la tête sur ces
mêmes problèmes, je pense que le language SQL n'est pas encore complètement
assimilé par PCSOFT (dommage à l'ai du client)serveur HF)
Il vaut donc mieux, si tu travailles en HF de faire des hlitrecherche...

"Vincent" a écrit dans le message de
news:43172300$0$23941$
Bjr,

J'utilise la requete suivante :
select * from
PROSPECT left join origine on PROSPECT.ogcleunik = origine.ogcleunik

Pas de pb.
Maintenant, si je rajoute un left join :

select * from
(PROSPECT left join ORIGINE on PROSPECT.ogcleunik = ORIGINE.ogcleunik)
left join EMPLOYE on EMPLOYE.emcleunik=PROSPECT.emcleunik

J'ai l'erreur "Erreur d'initialisation de la requête, mot PROSPECT
inattendu."


Avatar
mat
Vincent wrote:
Bjr,

J'utilise la requete suivante :
select * from
PROSPECT left join origine on PROSPECT.ogcleunik = origine.ogcleunik

Pas de pb.
Maintenant, si je rajoute un left join :

select * from
(PROSPECT left join ORIGINE on PROSPECT.ogcleunik = ORIGINE.ogcleunik)
left join EMPLOYE on EMPLOYE.emcleunik=PROSPECT.emcleunik

J'ai l'erreur "Erreur d'initialisation de la requête, mot PROSPECT
inattendu."




Bonjour,

il faut veiller à la bonne syntaxe et séparer les joins avec une
virgule. En plus, j'utilise INNER JOIN plutôt que LEFT JOIN, p.ex.

"FROM ProductGroup RIGHT OUTER JOIN InvoiceDetail ON
(InvoiceDetail.IDProductGroup = ProductGroup.IDProductGroup), " +...
"Product Inner Join InvoiceDetail ON (InvoiceDetail.IDProduct =
Product.IDProduct ), " +...
"Invoice INNER JOIN InvoiceDetail ON (InvoiceDetail.IDInvoice =
Invoice.IDInvoice), " +...
...
etc

donc ça marche, mais il n'y pas de règles pour la performance optimale
d'une requête HF multi-fichier. Il faut essayer...

salutations
mat
Avatar
Vincent
mat a écrit :
Vincent wrote:

Bjr,

J'utilise la requete suivante :
select * from
PROSPECT left join origine on PROSPECT.ogcleunik = origine.ogcleunik

Pas de pb.
Maintenant, si je rajoute un left join :

select * from
(PROSPECT left join ORIGINE on PROSPECT.ogcleunik = ORIGINE.ogcleunik)
left join EMPLOYE on EMPLOYE.emcleunik=PROSPECT.emcleunik

J'ai l'erreur "Erreur d'initialisation de la requête, mot PROSPECT
inattendu."





Bonjour,

il faut veiller à la bonne syntaxe et séparer les joins avec une
virgule. En plus, j'utilise INNER JOIN plutôt que LEFT JOIN, p.ex.

"FROM ProductGroup RIGHT OUTER JOIN InvoiceDetail ON
(InvoiceDetail.IDProductGroup = ProductGroup.IDProductGroup), " +...
"Product Inner Join InvoiceDetail ON (InvoiceDetail.IDProduct > Product.IDProduct ), " +...
"Invoice INNER JOIN InvoiceDetail ON (InvoiceDetail.IDInvoice > Invoice.IDInvoice), " +...
....
etc

donc ça marche, mais il n'y pas de règles pour la performance optimale
d'une requête HF multi-fichier. Il faut essayer...

salutations
mat



Pas très standard le SQL de PC-soft. ;-)

j'utilise des left join car un enregistrement de ma table prospect ne
contient pas obligatoirement de lien vers employe (idem pour origine)
Lien (0,1) - (0,n)

La requête :
select * from
PROSPECT left join ORIGINE on (PROSPECT.ogcleunik=ORIGINE.ogcleunik),
PROSPECT left join EMPLOYE on (EMPLOYE.emcleunik=PROSPECT.emcleunik)
ne retourne pas d'erreur mais raisonne comme un inner join.

seul les enrg qui ont prospect.ogcleunik ET prospect.emcleunik de
renseigné sont retourné.
Avatar
mat
Vincent wrote:
Pas très standard le SQL de PC-soft. ;-)

j'utilise des left join car un enregistrement de ma table prospect ne
contient pas obligatoirement de lien vers employe (idem pour origine)
Lien (0,1) - (0,n)

La requête :
select * from
PROSPECT left join ORIGINE on (PROSPECT.ogcleunik=ORIGINE.ogcleunik),
PROSPECT left join EMPLOYE on (EMPLOYE.emcleunik=PROSPECT.emcleunik)
ne retourne pas d'erreur mais raisonne comme un inner join.

seul les enrg qui ont prospect.ogcleunik ET prospect.emcleunik de
renseigné sont retourné.



alors, il faut utiliser LEFT OUTER JOIN, et ne pas pas LEFT JOIN, et
c'est assez standard, je crois.

salutations
mat