“Unknown column in 'field list'”, but column does exist

后端 未结 9 1400
既然无缘
既然无缘 2020-12-06 04:41
DROP TABLE IF EXISTS `transactions`;
CREATE TABLE `transactions` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_date` datetime DEFAULT NULL,
  PRIMAR         


        
9条回答
  •  没有蜡笔的小新
    2020-12-06 05:38

    Same error in a different scenario:

    This also happens when you miss @ symbol for a variable.

    SET @myVar1=1;  SELECT @myVar1;  -- GOOD, correctly prints:  1
    SET @myVar1=1;  SELECT  myVar1;  -- BAD, prints:  Unknown column 'myVar1' in 'field list' 
    

提交回复
热议问题