oussama frija
oussama frija

Reputation: 1

Query error ambiguous column name 4 inner join table in SQL

I get an ambiguous column name error with this query . I can't figure out why. They all seem to be joined correctly so why doesn't SSMS know to display Cin_Expéditeur and Numéro_Agent and Cin_Destinataire?

Query:

SELECT 
    Cin_Expéditeur,
    Nom_Expéditeur,
    Prénom_Expéditeur,
    Phone_Expéditeur,
    Adresse_Expéditeur,
    Numero_Agent,
    Cin_Destinataire,
    Numero_Transfert,
    Code_Transfert,
    Montant_Transfert
FROM
    Expéditeur E
        INNER JOIN
    Transfert_Argent TA ON (E.Cin_Expéditeur = TA.CIN_Expéditeur)
        INNER JOIN
    Agent A ON (A.Numero_Agent = TA.Numero_Agent)
        INNER JOIN
    Destinataire D ON (D.Cin_Destinataire = TA.Cin_Destinataire)

Upvotes: 0

Views: 42

Answers (1)

nbk
nbk

Reputation: 49373

All columns in the selct have point to a unique name, or you need to specify which table the column has to used.

For example your column Numero_Agent is minmum twice in your tables so you have to specify which table you want the column taken like TA.Numero_Agent

this goes for every column

Upvotes: 1

Related Questions