Skip to content Skip to sidebar Skip to footer

Nested "ifs" In A Select-where For A Conditional Dynamic Filtering

Recently I created a new website based on codeigniter 3-php and PHPMyADMIN-mysql and I integate one pagination more than that i did a dynamic search with ajax. My problem is when I

Solution 1:

Are you looking for a join and group by?

select f.id,
       count(*) as num_rows,
       sum(tare) as sum_tare
from history h join
     temp_fetch f
     on h.nom like concat('%', f.client, '%') or
        h.commune like concat('%', f.commune, '%')  or 
        h.type like concat('%', f.type, '%') or 
        h.mat like concat('%', f.matricule, '%') or 
        h.tare like concat('%', f.tare, '%')
where f.cancled = 0
group by f.id;

Post a Comment for "Nested "ifs" In A Select-where For A Conditional Dynamic Filtering"