php - How to arrange VARCHAR column? -
i have table contain varchar column .this table used pagination. please see sql fiddle table structure.
http://sqlfiddle.com/#!2/db5467/53
it contain column g_season
when fired query
select * from(select * games g_season > 'cvxv' order g_season asc ) s limit 1
it gives me correct g_id=7
when put 'dasd' gives me g_id=10
should g_id=12
because 7 , 12 g_id
column contain g_season , 'dasd' , sql fetch last matching row , nothing g_id=10
this should query if want g_id = 12
select * games g_season = 'dasd' order g_season asc limit 1
if have more 1 row identical g_season
need second sort column otherwise uncertain of returned row if there multiple matches.
edit maybe want
as long know how want order matched records can want, example first record (assuming ordering matched records g_id
asc):
select * games g_season = 'dasd' order g_id asc limit 0,1
this second record:
select * games g_season = 'dasd' order g_id asc limit 1,2
and can keep incramenting each record
Comments
Post a Comment