MySQL Forums
Forum List  »  Newbie

Join su tre tabelle con record doppi
Posted by: sandro carapella
Date: February 27, 2023 03:40PM

Il risultato della query sotto riportata restituisce i due record dei software e due volte lo stesso record con la stessa matricola dell'UPS. Se dovessi cancellare un software automaticamente l'Ups diventerebbe 1, altresì dovessi aumentare i software l'Ups diventerebbe numericamente uguale. Complicato vero? Mi sto perdendo, forse, in un bicchiere d'acqua? Dove sto sbagliando? La matricola deve essere 1 sola:

SELECT nuc.idnuc,
nuc.nuc,
nuc.denominazione,
hw_articoli.idarticolo,
hw_articoli.nucac,
hw_articoli.descrizione,
hw_articoli.matricola,
hw_articoli.idpcac,
hw_dbsoftware.idsoftware,
hw_dbsoftware.descsoft,
hw_dbsoftware.snsoft,
hw_dbsoftware.datainstsoft,
hw_dbsoftware.idpcsw,
idpc,
schedapp
FROM servizi.hw_dbpc as hw_dbpc
INNER JOIN servizi.hw_articoli as hw_articoli
ON hw_dbpc.idpc = hw_articoli.idpcac
INNER JOIN servizi.hw_dbsoftware as hw_dbsoftware
ON hw_dbpc.idpc = hw_dbsoftware.idpcsw
INNER JOIN servizi.nuc as nuc
ON nuc.idnuc = hw_articoli.nucac
AND nuc.idnuc = hw_articoli.descrizione
WHERE hw_dbpc.schedapp = '%d'

Grazie per la Vostra attenzione.

Options: ReplyQuote


Subject
Written By
Posted
Join su tre tabelle con record doppi
February 27, 2023 03:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.