Not sure where to put the GROUP BY clause in this SQL. Can anyone help?
select * from uk_postcode_towns where town like '%madi%'
order by case
when town like 'madi%' then 0
when town like '% %madi% %' then 1
when town like '%madi' then 2
else 3 end, town