フィールドの最初の文字がアルファではないという事実に基づいて行を選択するクエリを作成しようとしています。selectフィールドwhereフィールドregexpグループ
例、私はテーブルに次のデータを持って言うことができます:私は選択して、これを必要
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
:
3 days grace (and show a count of 1)
98 mute (and show a count of 2)
をここでは私のコードです:
select band, count(*) as count
from `songs`
where `band` REGEXP '^[^[:alpha:]]'
group by `band`
order by `band` asc
この全く働いていません。
構文が正しく、クエリが機能している必要があります。 MySQLのバージョンは何ですか?私達にあなたが持っている結果を示してください... –