Hi ,
I have a table called people which contains fields such as first_name, last_name, position, etc.
What i want to do is create an alphabetical filter on my search so that i can show all the [ A - D]s [E - H]s s etc. based on the last_name. So the user can click to see all the people whose names begin with the letters selected.
Now my approach at doing this seems long winded, here look:
$sql="
SELECT *
FROM people
WHERE people.staff_category = 'Postgrad'
AND people.status = 'live'
AND people.last_name LIKE 'A%'
OR people.last_name LIKE 'B%'
OR people.last_name LIKE 'C%'
OR people.last_name LIKE 'D%'
";
And i will have a statement like for the [ E- H] [ I _ L] etc. very tedious.
Does anyone know a smarter way to achieve this please.
Thanks in advance