基于数据类型的C编程测验

时间:2018-07-08 11:36:52

标签: c

SELECT 
   status_records.status AS statusname
 , COUNT(*) AS statuscount   
FROM (

  SELECT 
   'Open' AS status
  UNION ALL
  SELECT 
   'Closed' AS status
  UNION ALL
  SELECT 
   'Rejected' AS status
  UNION ALL
  SELECT 
   'Cancelled' AS status
) AS status_records

LEFT JOIN 
 myTable
ON
 status_records.status = myTable.status
GROUP BY
 status_records.status

有人可以告诉我为什么程序输出为-121吗? 预先谢谢你

1 个答案:

答案 0 :(得分:0)

发生这种情况的原因是integer overflow。最大char值为127,求和结果为135,更多