Jump to content

Error 1066 MySQL


zioarnold

Recommended Posts

Greetings what's wrong with this script ?

SELECT
  PE.nome_paziente         AS Nome,
  PE.cognome_paziente      AS Cognome,
  PE.indirizzo_paziente    AS Indirizzo,
  PE.data_nascita_paziente AS DataNascita,
  E.descrizione            AS NomeEsame,
  PE.data_esame            AS DataEsame,
  PE.ora_esame             AS OraEsame,
  U.tipo_urgenza           AS NomeUrgenza,
  O.nome_ospedale          AS NomeOpsedale
FROM
  prenota_esame PE,
  esame E,
  urgenza U,
  ospedale O
    INNER JOIN esame E
      ON PE.cod_esame = E.id_esame
    INNER JOIN urgenza U
      ON PE.cod_urgenza = U.id_urgenza
    INNER JOIN ospedale O
      ON PE.cod_ospedale = O.id_ospedale
ORDER BY
  id_prenotazione DESC
LIMIT 1;

Here below u see the DB Dictionary...

post-199207-0-03198900-1465658278_thumb.png

post-199207-0-16843000-1465658280_thumb.png

Link to comment
Share on other sites

FIXED Thanks!

SELECT
   PE.nome_paziente AS Nome,
   PE.cognome_paziente AS Cognome,
   PE.indirizzo_paziente AS Indirizzo,
   PE.data_nascita_paziente AS DataNascita,
   E.descrizione AS NomeEsame,
   PE.data_esame AS DataEsame,
   PE.ora_esame AS OraEsame,
   U.tipo_urgenza AS NomeUrgenza,
   O.nome_ospedale AS NomeOpsedale 
FROM
   prenota_esame AS PE
LEFT JOIN
   esame as E
      ON E.id_esame = PE.cod_esame
LEFT JOIN
   urgenza as U
     ON U.id_urgenza = PE.cod_urgenza  
LEFT JOIN
   ospedale as O
     ON O.id_ospedale = PE.cod_ospedale
ORDER BY
   id_prenotazione  DESC LIMIT 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...