1093错误:
要更新某表,同时该表有字段值又来自该表的查询语句。
例如:
INSERT INTO m_bulletincategory
(
OrganizationKey
, CategoryName
, DisplayNo
,
DisplayFlag
, LastUpdateLoginID
, LastUpdateTime
)
VALUES
(
‘eik549s2qefxr7v6lvkr‘
, ‘掲示板カテゴリ名 ‘
,
(SELECT IFNULL(Max(DisplayNo),0) + 1 FROM m_bulletincategory)
, 1
, 0
, Now()
)
解决办法,复查询
INSERT INTO m_bulletincategory
(
OrganizationKey
, CategoryName
, DisplayNo
,
DisplayFlag
, LastUpdateLoginID
, LastUpdateTime
)
VALUES
(
‘eik549s2qefxr7v6lvkr‘
, ‘掲示板カテゴリ名 ‘
,
(SELECT IFNULL(Max(DisplayNo),0) + 1 FROM (select * from m_bulletincategory) tt)
, 1
, 0
, Now()
)
原文地址:http://www.cnblogs.com/lizikang2013/p/3757098.html