-1
I am trying to make an SQL query that selects only one element per cat_id, from the genus of a cycle For where it checks if there is already a cat_id=1 and if you already have it goes forward until you run the whole table.
I am using this function to fetch all files
public function get_products()
{
$sql = "SELECT * FROM products";
$query = $this->db->query($sql);
return $query->result_array();
}
and I just want to get 1 per cat_id
thank you, that was exactly it
– Ricardo Martins