Skip to content
Advertisement

SQL Request with LEFT JOIN not able to find data

I’m working on my C# project and I have to get data from database thanks to .sql procedures.

Synthesis :

Table ProprietesCourantes is linked to table Entite.

Table Archive is linked to table EntiteArchive

==> I would like to make a link between ProprietesCourantes and Archive thanks to field Libellé

Table ProprietesCourantes

I have several tables in my case :

enter image description here

Table Entite

enter image description here

Table Archive

enter image description here

Table EntiteArchive

enter image description here

MY SQL REQUEST :

enter image description here

As you can see : Cotation and DateValiditeQuestionnaireDeSoutien are NULL because LEFT JOIN Archive ON (Archive.IdEntite = ProprietesCourantes.IdEntite can’t work (different IDEntite).

I tried to replace by this, but it doesn’t work, any idea ?

Advertisement

Answer

It is not easy to see how your tables are… could it be possible that Archive table has no rows for IdEntite=’165′? Are the two keys of the same format? You are showing the output for IdEntite=’165′ but the 4 example tables are for 2 different IdEntite. Can you provide more insights?

Edited: For what I understand, you want to join by Libelle field both ProprietesCourantes and Archive but your join is based on IdEntite?

If so, use an intermediate table join “`…

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement