MySQL Forums
Forum List  »  Italian

query error 1140
Posted by: Riccardo Castellani
Date: March 27, 2019 11:18PM

Sto lavorando da poco in ambiente Mysql Workbench 8.0.15 (OSX 10.14) e sto scrivendo una query che purtroppo mi restituisce l'errore 1140 che riguarda la modalità sql ONLY_FULL_GROUP_BY.

Questa è la query che devo ho e non devo utilizzare 'group by' in quanto non ancora studiato:
"Indicare codice fiscale, nome e cognome ed età del paziente più anziano della clinica, e il numero di medici dai quali è stato visitato"


SELECT P.Nome, P.Cognome, COUNT(DISTINCT(V.Medico))
FROM VISITA V INNER JOIN PAZIENTE P ON
V.Paziente = P.CodFiscale
WHERE V.Paziente IN
(
SELECT P1.CodFiscale
FROM PAZIENTE P1 LEFT OUTER JOIN PAZIENTE P2 ON
P1.DataNascita > P2.DataNascita
WHERE P2.DataNascita IS NULL
)



Non capisco se semanticamente sia lecito inserire nella SELECT l'operatore COUNT insieme ad altri attributi che non hanno a che vedere con il conteggio.
Dove sbaglio?

Di seguito l'elenco tabella ed i relativi campi

MEDICO
Matricola
Nome
Specializzazione
Parcella
Città

PAZIENTE
CodFiscale
Cognome
Nome
Sesso
DataNascita
Citta
Reddito

VISITA
Medico
Paziente
Data
Mutuata

Options: ReplyQuote


Subject
Views
Written By
Posted
query error 1140
978
March 27, 2019 11:18PM


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.