Make a mysql php filter with different tables

0

Hello friends, I'm trying to filter for items that are in my database but in different tables.

I have managed to make it bring me the values of a "headquarters" table but I want to add one that only shows me the values of the users that are only in that headquarters.

I have read something that can be done with a join but some that I have seen take a long time to execute and I still do not understand why.

That's how I'm doing my searches via php

function listUser($conexion){

    $consulta = (mysqli_query($conexion, "SELECT *, p.nombre as personaNombre
                                          FROM sede as p
                                          //luego de la busqueda , el orden   
                                          ORDER BY p.nombre ASC")) or die("Error listando Usuarios: ".mysqli_error($conexion));

    return $consulta;
}

the host table has an id that already brings me the name of the elements that are there but as what is difficult for me is to append the following field according to the first result ... thanks

the filter would consist of 3 tables branch, user, department

headquarters: id, name user: id, id_person, apartment_id, name and password department: id, id_sede, name

    
asked by Juan Ortiz 20.03.2018 в 18:35
source

0 answers