Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does this query return too many results?

Tags:

mysql

I have a mysql query

Select * from tbl_schoolphotos where Filename like 
         'glasshouse_1_%' order by DateTaken

I would like to match

  • glasshouse_1_20122204123455
  • glasshouse_1_20122206102415

but not

  • glasshouse_18_20122206102415

but its matching all three. Anyone know why? Does _ have special meaning in mysql?

like image 869
Toby Allen Avatar asked Dec 20 '25 11:12

Toby Allen


1 Answers

Because the underscore matches any single character

like image 167
odiszapc Avatar answered Dec 24 '25 02:12

odiszapc