Mysql - 错误代码1054'where子句'中的未知cloumn'plarss.p_name'

时间:2017-05-07 11:23:25

标签: mysql-error-1054

您好,

首先,我希望你展示我的桌子:

string ->  |Hello|world|

我想要这个查询:

CREATE TABLE `channels` (
`channel_id` int(11) NOT NULL AUTO_INCREMENT,
`channel_name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`channel_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8

CREATE TABLE `gamepoints` (
 `gp_id` int(11) NOT NULL AUTO_INCREMENT,
 `gamble` int(11) DEFAULT NULL,
 `roulette` int(11) DEFAULT NULL,
 `blackjack` int(11) DEFAULT NULL,
 `slots` int(11) DEFAULT NULL,
 PRIMARY KEY (`gp_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8

CREATE TABLE `player_channel` (
`pc_id` int(11) NOT NULL AUTO_INCREMENT,
`players_id` int(11) DEFAULT NULL,
`channel_id` int(11) DEFAULT NULL,
 PRIMARY KEY (`pc_id`),
 KEY `players_id_idx` (`players_id`),
KEY `channel_id_idx` (`channel_id`),
CONSTRAINT `channel_id` FOREIGN KEY (`channel_id`) REFERENCES `channels` (`channel_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `players_id` FOREIGN KEY (`players_id`) REFERENCES `players` (`players_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8

CREATE TABLE `players` (
 `players_id` int(11) NOT NULL AUTO_INCREMENT,
 `p_name` varchar(45) DEFAULT NULL,
 `p_right` varchar(45) DEFAULT NULL,
 `gp_id` int(11) DEFAULT NULL,
PRIMARY KEY (`players_id`),
KEY `gp_id_idx` (`gp_id`),
CONSTRAINT `gp_id` FOREIGN KEY (`gp_id`) REFERENCES `gamepoints` (`gp_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8

但是当我这样做时,我得到了这个错误:

UPDATE gamepoints SET gamble = 1 
WHERE gamepoints.gp_id = players.gp_id
AND players.p_name = "test"
AND player_channel.players_id = players.players_id
AND player_channel.channel_id = channels.channel_id
AND channels.channel_name = "test";

我不知道我做错了什么,我在设置为添加所有表之后也尝试过,但这也不行。

如果有人可以帮助我,我会很高兴:)

提前致谢

0 个答案:

没有答案