I made a query and took all customers_from starting with first and grouped but my problem is that I want to do the same thing but on all the fields customers_from
For example, I have the following names in my fields:
1st_qwe, 1st_asd, 1st_ghj, 1st_poi, add_qwe, add_rtz, add_lkj, add_puz, poi_ghj, poi_gjhgj, poi_tgb etc...
So I'd like to take the three letter and condition like that
Code:
SELECT IF (customers_from LIKE '1st%','1rst',customers_from) AS Origin,
COUNT (cu.customers_id) AS effectif_vg
FROM en_customers cu INNER JOIN en_commands co on cu.customers_id = co.customers_id
WHERE customers_free ='1'
GROUP BY Origin"
Is there a solution to my problem?
Bookmarks