Reputation: 5704
I'm using VB.NET with the MySQLConnector, I have an ID column with differents values, i.e:
101
102
201
202
203
302
304
305
306
I want to select all the values that start with "3" and then, select the MAX of them, in this case, "306"
Any suggestion? Thanks
Upvotes: 1
Views: 691
Reputation: 56789
select max(id) from Data
where left(cast(`id` as char(10)), 1) = '3';
Demo: http://sqlize.com/w2tJP1T7ur
Upvotes: 1