<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                有些時候在mySql的SQL語句中使用max(),min()獲取最大、最小值時,獲取到的結果跟預期的結果不一樣,這是因為在查找的時候獲取字段的字段類型會影響我們獲取的結果,比如我現在遇到的這個,就是。我在獲取最大值時,按照以往的經驗寫的sql語句。 select MAX(ord) from table_namewhere state != 2 and branch_code = 1101 1 但是結果并不是我想要的,最后發現是這個ord時候String類型的,當我轉成integer類型再去查時,就能得到我預期的結果。 ** 這里有幾種方法去轉 ** 1、利用“+”運算符,語法“‘字符串’ + 0”; ~~~ select MAX(ord + 0) from table_name where state != 2 and branch_code = 1101 ~~~ 2、利用cast()函數,語法“cast(‘字符串’ as 數值類型)”; 2.1:取整數:SIGNED ~~~ select MAX(CAST(ord as signed)) from table_name where state != 2 and branch_code = 1101 ~~~ 2.2:取無符號整數 : UNSIGNED ~~~ select MAX(CAST(ord as UNSIGNED)) from table_name where state != 2 and branch_code = 1101 ~~~ 2.3:浮點數 : DECIMAL ~~~ select MAX(CAST(ord as DECIMAL(10,2))) from table_name where state != 2 and branch_code = 1101 ~~~ 3、利用convert()函數,語法“convert(‘字符串’, 數值類型)” 3.1:整數:SIGNED ~~~ select MAX(CONVERT(ord,SIGNED)) from table_name where state != 2 and branch_code = 1101 ~~~ 3.2:無符號整數 : UNSIGNED ~~~ select MAX(CONVERT(ord,UNSIGNED)) from table_name where state != 2 and branch_code = 1101 ~~~ 3.3:浮點數 : DECIMAL ~~~ select MAX(CONVERT(ord,DECIMAL(10,2))) from table_name where state != 2 and branch_code = 1101 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看