I am trying to write a query that will select rows based on the fact that the first character in the field is not an alpha.
Example, lets say I have the following data in the table:
id | band | song
1 | 3 days grace | song name
2 | avenged sevenfold | song name
3 | as i lay dying | song name
4 | 98 mute | song name
5 | 98 mute | another song name
I need this to select:
3 days grace (and show a count of 1)
98 mute (and show a count of 2)
Here is my code:
select band, count(*) as count
from `songs`
where `band` REGEXP '^[^[:alpha:]]'
group by `band`
order by `band` asc
This is not working at all.
I have tried your query in my database and it worked just fine, so the problem is not with the REGEXP but something else. Title and Articles are columns in my database. Interesting how AS COUNT works without count being encapsulated in `.