SQL-select max(ID) query char type, the maximum value can only be 9

p1 p2 p3 p9 p10 Unable to determine that p10 is the maximum value. Solution:
select max(CAST(REPLACE(EXPNUM,'P','') AS INT)) from point

1 2 3 4 9 10 Number judgment method:
SELECT MAX(CAST(ID AS INT)) AS ID FROM DCP_ZB

Guess you like

Origin blog.csdn.net/qq_27946017/article/details/113698874