Selecting/casting output as integer in SQL

后端 未结 5 1586
野的像风
野的像风 2020-12-14 16:01

I\'m working on a site that requires me to display a graph of the average number per day of a user input. I have a SQL query already that returns this info to me:

         


        
5条回答
  •  鱼传尺愫
    2020-12-14 16:35

    Use the DIV operator.

    mysql> SELECT 5 DIV 2;
        -> 2
    

    Integer division. Similar to FLOOR(), but is safe with BIGINT values. Incorrect results may occur for noninteger operands that exceed BIGINT range.

提交回复
热议问题