Gino Perla
Gino Perla

Reputation: 101

select statement unknown column (inner join)

  SELECT `testF`.`id_documento`,
    `clienti`.`nome_cliente`,
    `clienti`.`cognome_cliente`,
    `clienti`.`partita_iva`,
    `clienti`.`codice_fiscale`,
    `testF`.`numero_fattura`,
    `testF`.`totale_documento`,
    `clienti`.`codice_pubblica_amministrazione`,
    `clienti`.`id_cliente`

FROM `logindb`.`clienti` as cliente
    INNER JOIN `logindb`.`testata_documento` as testF
    ON cliente.`id_cliente` = testF.`id_cliente`

    WHERE `clienti`.`id_cliente` = 1 AND `clienti`.`id_utente`=10;

I get unknown column clienti.nome_cliente It seems like it's a problem related to the inner join, but it seems ok to me

Upvotes: 0

Views: 48

Answers (1)

juergen d
juergen d

Reputation: 204854

The problem is that you give clienti another name here

FROM `logindb`.`clienti` as cliente

if you do so, you have to use the new name everywhere in your query and not the original one.

Upvotes: 1

Related Questions