Ciao a tutti,
ho un problema che non riesco a risolvere con PHP e MySql, ovvero il collegamento di tre tabelle di un database.
Le tabelle sono:
- gallery
- category_gallery
- sottocategory_gallery
Struttura gallery "Sintetizzata":
- id
- foto
- id_cat
- id_sot
Struttura category_gallery
- id_cat
- nomecat
Struttura sottocategory_gallery
- id_sot
- nomesot
Ho eseguito tre query diverse, ma mi da sempre errore:
1) SELECT * FROM ((gallery INNER JOIN category_gallery ON gallery.id_cat = category_gallery.id_cat) INNER JOIN sottocategory_gallery ON gallery.id_sot = sottocategory.id_sot)
2) SELECT * FROM (gallery INNER JOIN category_gallery ON gallery.id_cat = category_gallery.id_cat INNER JOIN sottocategory_gallery ON gallery.id_sot = sottocategory.id_sot)
3) SELECT * FROM gallery JOIN category_gallery ON gallery.id_cat = category_gallery.id_cat AND gallery.id_sot = sottocategory_gallery.id_sot
Se collego due tabelle invece funziona perfettamente:
SELECT * FROM gallery INNER JOIN category_gallery ON gallery.id_cat = category_gallery.id_cat
Dove può essere l'errore? Ho sempre collegato più tabelle tra di loro utilizzando la prima sintassi, con database ACCESS e non ho mai avuto problemi.. Forse MySql ha un'altra sintassi?
Grazie a tutti, Max