mysql - 字段未插入或更新,sql 中的 int 类型

标签 mysql sql magento

我正在 magento 平台上工作。我遇到了有关将值插入到特定字段的问题:我的查询运行完美,但一个特定列不适用于任何查询。我尽力而为,但没有找到原因。当我更改列类型从 int 到 varchar 类型都可以。这是我的表结构。

CREATE TABLE `followupemails_emaillogs` (
  `id` int(8) NOT NULL AUTO_INCREMENT,
  `schedule_time` datetime DEFAULT NULL,
  `sent_time` datetime DEFAULT NULL,
  `email_status` varchar(100) DEFAULT NULL,
  `client_name` varchar(250) DEFAULT NULL,
  `client_email` varchar(250) DEFAULT NULL,
  `followupemails_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1.

“followupemails_id”列在插入和更新查询中不起作用。这是一个更新查询,其中存在该 id(29) 的记录。 更新 followupemails_emaillogs SET followupemails_id=5 WHERE id =29。 这是插入查询INSERT INTO followupemails_emaillogs SET followupemails_id=4, Schedule_time='2013-10-23 08:10:00', email_status='pending', client_name='ayaz ali'。这工作正常在 fiddle 上但不在我的 sqlyog 上?可能是什么问题。最后我发现查询工作完美

.INSERT INTO followupemails_emaillogs (followupemails_id,schedule_time,email_status,client_name,client_email) 值 (26,'2013-10-23 08:10:00','pending','ayaz ali','mamhmood@ yahoo.com'); 谁能告诉我为什么设置查询不起作用但第二个查询工作完美。这样我就可以接受他的答案。感谢您的帮助

最佳答案

尝试这样

创建,

CREATE TABLE followupemails_emaillogs (
  id int(8) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  schedule_time datetime DEFAULT NULL,
  sent_time datetime DEFAULT NULL,
  email_status varchar(100) DEFAULT NULL,
  client_name varchar(250) DEFAULT NULL,
  client_email varchar(250) DEFAULT NULL,
  followupemails_i int(11) DEFAULT NULL,
  UNIQUE (id)
)

插入,

INSERT INTO followupemails_emaillogs (schedule_time,sent_time,email_status,client_name,client_email,followupemails_i) 
VALUES 
('2012-05-05','2012-05-06',"sent","sagar","sagar@xxxx.com",2)

关于mysql - 字段未插入或更新,sql 中的 int 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19532850/

相关文章:

magento - 我可以在 "create url"按钮处更改 magento 网格中的 "add new"吗

magento - 始终在结帐页面中展开税务摘要 - magento

mysql 无法删除损坏的 innodb 表

php - 每个关键字 10 条记录 SQL

php - 在 MySql 查询中需要帮助 INSERT IF NOT EXISTS 否则 UPDATE

mysql - 在 SQL 中加入具有相同 ID 的两行的 SELECT

mysql - 使用嵌套子查询和 GROUP BY 的 SQL 查询

sql - SQL SERVER 2008 中的复合 IDENTITY 列

MYSQL 和关系数据库管理系统

firefox - 运行 MTAF 时使用 selenium server 2.24.1 和 firefox 13 截屏