Select specific words

时间:2016-04-07 10:48:20

标签: mysql sql

enter image description here

How can I only select rows that contains column-Grade value like Grade 1, Grade 10, Grade 11, Grade 12... from the table?

3 个答案:

答案 0 :(得分:1)

尝试这样的想法:

SELECT *
FROM t
WHERE Grade LIKE 'Grade 1%'

答案 1 :(得分:0)

Get the grade column value vertically like below

SELECT SUBSTRING_INDEX(Grade,'-',1) FROM table_name

and then after convert them to rows

答案 2 :(得分:0)

嘿,你可以这样试试

select * from tableName where SUBSTRING_INDEX(Grade,'-',1) = 'Grade 1';