Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Bonjour tout le monde,
Est ce que quelqu'un peut m'indiquer comment je peux faire la jointure sur trois tables, sachant que ces tables n'ont pas les mêmes appellations de champs.
La requête sur Oracle est la suivante:
select cust_account_id, hca.party_id, party_name as client, party_number, ooha.attribute4 as client_final, header_id from cust_accounts ca, parties p, headers h
where
ca.party_id = p.party_id
and h.sold_to_org_id=ca.cust_account_id;
Notre objectif est de récupérer le nom d'un client, en utilisant les tables parties et cust_accounts.
Je mets en pièce jointe une image pour montrer plus simplement notre objectif.
Merci.
Bonjour Hela,
Une solution parmi tant d'autres à te proposer :
Tmp_PARTIES:
LOAD * INLINE [
PARTY_ID, PARTU_NAME
];
Tmp_CUST_ACCOUNTS:
LOAD * INLINE [
PARTY_ID, CUST_ACCOUNT_ID, ACCOUNT_NAME
];
Tmp_HEADERS:
LOAD * INLINE [
SOLD_TO_ORG_ID, CLIENT_FINAL
];
PARTIES:
LOAD
PARTY_ID as %PARTY_ID%,
PARTU_NAME
RESIDENT Tmp_PARTIES;
CUST_ACCOUNTS:
LOAD
PARTY_ID as %PARTY_ID%,
CUST_ACCOUNT_ID as %CUST_ACCOUNT_ID%,
ACCOUNT_NAME
RESIDENT Tmp_CUST_ACCOUNTS;
HEADERS:
LOAD
SOLD_TO_ORG_ID as %CUST_ACCOUNT_ID%,
CLIENT_FINAL
RESIDENT Tmp_HEADERS;
DROP TABLES Tmp_PARTIES, Tmp_CUST_ACCOUNTS, Tmp_HEADERS;
Bonjour Hela,
Une solution parmi tant d'autres à te proposer :
Tmp_PARTIES:
LOAD * INLINE [
PARTY_ID, PARTU_NAME
];
Tmp_CUST_ACCOUNTS:
LOAD * INLINE [
PARTY_ID, CUST_ACCOUNT_ID, ACCOUNT_NAME
];
Tmp_HEADERS:
LOAD * INLINE [
SOLD_TO_ORG_ID, CLIENT_FINAL
];
PARTIES:
LOAD
PARTY_ID as %PARTY_ID%,
PARTU_NAME
RESIDENT Tmp_PARTIES;
CUST_ACCOUNTS:
LOAD
PARTY_ID as %PARTY_ID%,
CUST_ACCOUNT_ID as %CUST_ACCOUNT_ID%,
ACCOUNT_NAME
RESIDENT Tmp_CUST_ACCOUNTS;
HEADERS:
LOAD
SOLD_TO_ORG_ID as %CUST_ACCOUNT_ID%,
CLIENT_FINAL
RESIDENT Tmp_HEADERS;
DROP TABLES Tmp_PARTIES, Tmp_CUST_ACCOUNTS, Tmp_HEADERS;
Votre solution me semble très intéressante, mais j'aimerais bien comprendre quelque chose avant de la mettre en pratique.
J'aimerais bien savoir l'utilité de l'utilisation des tables temporaire en général. Et je veux aussi savoir la cause pour laquelle vous avez renommé les champs en %champ%.
Merci.
Les tables temporaires ne sont pas obligatoires dnas votre cas.
Vous pouvez intégrer les 3 tables que vous avez.
Le "%" fait partie des best practices pour mieux identifier vos clés (ID) dans vos tables.
Par la suite, vous pouvez interdire la visualisation de vos clés de la manière suivante : SET hidePrefix = '%'; ainsi la lecture de vos clés ne sera pas possible par les utlisateurs dnas QlikView.
J'espère avoir pu répondre à vore question.