【问题标题】:type casting in mysql在 mysql 中进行类型转换
【发布时间】:2010-06-17 07:55:26
【问题描述】:

我在数据库中有passportno(varchar)。
我正在输入这样的值 001,002,003。我想显示排序顺序。

现在我写了这样的查询"select * from passport_registration where status=1 ORDER BY passportno" 然后显示这样的输出......077,088,099,100,1000,1001,1009,101,1010 我想显示排序顺序。怎么办?

【问题讨论】:

    标签: mysql casting


    【解决方案1】:

    ORDER BY CAST(passportno AS UNSIGNED)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-20
      • 1970-01-01
      相关资源
      最近更新 更多