php - Order a list by the second and third text in a field -
i have table text column, prono
, values contain 4 (4) combination numbers -
in-between them.
example data:
id prono 01 012-40-45-7894 02 045-12-13-8048 03 012-40-44-9704
i wanted fetch whole row , sort list database based on second , third number. there way this?
currently, , temporarily, sort them whole.
mysqli_query($connection,"select * table order prono");
and output (based example data above):
id prono 03 012-40-44-9704 01 012-40-45-7894 02 045-12-13-8048
but what need output (it arrange based on second , third pattern of numbers):
id prono 02 045-12-13-8048 03 012-40-44-9704 01 012-40-45-7894
is doable? , how?
try use substring select * table order substr(prono,5,2), substr(prono,8,2)
substring gives substring of prono position 5 length 2 , other stubstring 8 length 2 (what substring need order. more information tu substr can find on mysql.com
Comments
Post a Comment