Mysql oberten singles of artists

0

I'm trying to get the user's singles, but I can not do it. If someone gives me a hand I'd appreciate it.

Here I leave my database

link

    
asked by NuriaOveeeeeeejero 16.02.2018 в 19:17
source

1 answer

0

To bring all the singles of the PERSONAL table that is what I suppose you refer to users, you can try:

SELECT a.* FROM discografica.cancion a
INNER JOIN discografica.singles b ON b.idsingles = a.idsingles
INNER JOIN discografica.grupo c ON c.idgrupo = b.idgrupo 
INNER JOIN discografica.grupo_artista d ON d.idgrupo = c.idgrupo
INNER JOIN discografica.artistas e ON e.idartistas = d.idartistas
INNER JOIN discografica.gestion f ON f.idartistas = e.idartistas
INNER JOIN discografica.personal g ON g.idpersonal = f.idpersonal

Now if you want a specific user, just add the password WHERE:

SELECT a.* FROM discografica.cancion a
INNER JOIN discografica.singles b ON b.idsingles = a.idsingles
INNER JOIN discografica.grupo c ON c.idgrupo = b.idgrupo 
INNER JOIN discografica.grupo_artista d ON d.idgrupo = c.idgrupo
INNER JOIN discografica.artistas e ON e.idartistas = d.idartistas
INNER JOIN discografica.gestion f ON f.idartistas = e.idartistas
INNER JOIN discografica.personal g ON g.idpersonal = f.idpersonal
WHERE g.idpersonal = $idpersonal

$ idpersonal (parameter with the user's code)

    
answered by 16.02.2018 в 20:41