how to select max of mixed string/int column?

后端 未结 6 1255
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 22:10

Lets say that I have a table which contains a column for invoice number, the data type is VARCHAR with mixed string/int values like:

invoice_number
*********         


        
6条回答
  •  渐次进展
    2020-12-08 22:45

    This should work also

    SELECT invoice_number
    FROM invoice_header
    ORDER BY LENGTH( invoice_number) DESC,invoice_number DESC 
    LIMIT 0,1
    

提交回复
热议问题