I can sort the whole thing A-Z and it works fine, but if i try and sort by just 1 letter, it doesnt work..
For instance:
"SELECT *,TRIM(LEADING 'the ' FROM LOWER(title)) AS title_x FROM table ORDER BY title_x ASC"
this works fine and sorts/fetches the results A-Z disregarding the 'The '.. But:
"SELECT *,TRIM(LEADING 'the ' FROM LOWER(title)) AS title_x FROM table WHERE title_x LIKE 'A%' ORDER BY title_x ASC"
doesnt work, it just says "Unknown column 'title_x' in 'where clause'"
Can anyone help me correct this? Thanks.
UPDATE
For anyone else having this problem, changing the WHERE for HAVING makes this work perfectly.