I have 2 tables in my DB, one is "users" with the fields "id", "name" and "surnames"
The second "sales" has the fields "id_venta" "id_vendedor" and "id_comprador" and what I want is to generate an html table in which the names and surnames of the buyer and seller appear.
Id_venta-------- Vendedor --------- Comprador
1----------------Manuel Perez-------- Pepe Fernandez
It occurs to me how to do it with a join between the 2 tables to take for example the name of the seller, but how can I extract the name of the seller and the buyer at the same time? I'm using codeigniter as a framework.
$this->db->select('*');
$this->db->from('ventas');
$this->db->join('usuarios','usuarios.id = ventas.id_vendedor');