我正在尝试在MySql中创建可更新的视图,但结果不可更新。 Attrepgen是第一个字段(aidx = numauto)是PK的表。
知道为什么attrepusr不可更新?
CREATE
ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `attrepusr` AS
select
`attrepgen`.`Aidx` AS `Aidx`,
`attrepgen`.`IsOffset` AS `IsOffset`,
`attrepgen`.`Dt` AS `Dt`,
`attrepgen`.`Owner` AS `Owner`,
`attrepgen`.`P1` AS `P1`,
`attrepgen`.`P2` AS `P2`,
`attrepgen`.`P3` AS `P3`,
`attrepgen`.`P4` AS `P4`,
`attrepgen`.`P5` AS `P5`,
`attrepgen`.`P6` AS `P6`,
`attrepgen`.`Target` AS `Target`,
`attrepgen`.`Attend` AS `Attend`,
`attrepgen`.`Delta` AS `Delta`,
`attrepgen`.`Remark` AS `Remark`,
`attrepgen`.`Cat` AS `Cat`
from
`attrepgen`
where
(`attrepgen`.`Owner` = current_user())
获取信息,表格attrepgen:
CREATE TABLE `attrepgen` (
`Aidx` int(11) NOT NULL AUTO_INCREMENT,
`IsOffset` tinyint(1) NOT NULL,
`Dt` date NOT NULL,
`Owner` varchar(16) NOT NULL,
`P1` time DEFAULT NULL,
`P2` time DEFAULT NULL,
`P3` time DEFAULT NULL,
`P4` time DEFAULT NULL,
`P5` time DEFAULT NULL,
`P6` time DEFAULT NULL,
`Target` decimal(7,3) NOT NULL,
`Attend` decimal(7,3) NOT NULL,
`Delta` decimal(7,3) NOT NULL,
`Remark` varchar(32) DEFAULT NULL,
`Cat` varchar(1) DEFAULT NULL,
PRIMARY KEY (`Aidx`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
我有点困惑。
答案 0 :(得分:0)
好的,明白了。必须说我的基地实际上是Access中的前端。当试图修改工作台中的某个字段时,该白痴不接受(继续说'只读")。但是当我在前端重新链接我的View时,这次我可以修改那条线。
可能工作台根本不允许在视图中修改,但是希望您直接在源表中修改。
更好地了解它。
感谢大家,很高兴知道我们并不孤单(在黑暗中):p