Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A little MySQL help
#1
I have the following structure:
 brief description
 code

I need to create a view with the top 5 'nombre_institucion' from the first table with most 'delitos' (entries in antecedente_delito).
Basically the result I need in the view is:


Nombre_institucionnumero_delitos
inst132
inst230
inst325
inst418
inst510
Reply
#2
Screw this im writing in spanish:

No puedo recordar los codigos ahorita, pero se que necesitas relacionar la tabla que tiene los nombres de las instituciones con la tabla que tiene los delitos, despues tienes que hacerle un "order by" descendente (Creo que es ese el que va de menor a mayor), despues tienes que hacer una condicion para que te de los primeros 5 resultados de ese order by para mostrarlos.
Reply
#3
The descending order and limit are easy, I'm stuck on how to relate both tables, since I have to go through like 3 in between.
Reply
#4
Manu Wrote:The descending order and limit are easy, I'm stuck on how to relate both tables, since I have to go through like 3 in between.

Tenes que traertelas contigo, porque sino, no relacionara los datos y no te traera nada. Lo que si no me acuerdo es como ocultar los campos que no quieres mostrar.

Si tuviera access en esta maquina te haria la relacion facilmente desde las tablas graficas que tiene.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)