缺少Mysql错误值

时间:2015-03-10 08:50:50

标签: mysql

错误中的qa_contact列存在无效值 表。 (profiles表中userid中不存在这些值 专栏。)

以下是错误:

  

错误:错误中的qa_contact列存在无效值   表。 (这些值在用户标识的配置文件表中不存在   在继续checksetup之前,您需要修复这些问题   值,通过从数据库中删除这些行,或更改   错误中qa_contact的值指向有效值   profiles.userid。 bugs.qa_contact列中的错误值为:4,   5,8,9,10,13,16,17,18,19,20,21,23,25,26,27,28,30,   32,33,34,35,36,37,40,41,45,46,47,49,51,52,53,54,58,61,   62,63,68,70,73,74,85,90,91,92,95,101,102,103,112,122,   124,126,129,135,142,156,157,161,166,172,175,178,207,208,   209,212,215,216,221,222,223,224,226,231,237,238,239,240,   242,245,248,250,251,253,254,257,258,259,260,261,262,267,   270,273,276,278,279

请指导我如何添加缺失值

1 个答案:

答案 0 :(得分:0)

您可以为现有记录

DELETE bugs WHERE bugs.qa_contact NOT IN
(4, 5, 8, 9, 10, 12, 13, 16, 17, 18, 19, 20, 21, 23, 25, 26, 27, 28, 30, 32, 33, 34, 35, 36, 37, 40, 41, 45, 46, 47, 49, 51, 52, 53, 54, 58, 61, 62, 63, 68, 70, 73, 74, 85, 90, 91, 92, 95, 101, 102, 103, 112, 122, 124, 126, 129, 135, 142, 156, 157, 161, 166, 172, 175, 178, 207, 208, 209, 212, 215, 216, 221, 222, 223, 224, 226, 231, 237, 238, 239, 240, 242, 245, 248, 250, 251, 253, 254, 257, 258, 259, 260, 261, 262, 267, 270, 273, 276, 278, 279);

您应该检查错误记录的有效性

SELECT * from profiles p INNER JOIN bugs b ON p.userid = b.qa_contact WHERE b.qa_contact = '253'

然后如果没有返回记录,那么你应该从bug表中删除那些记录

DELETE FROM bugs WHERE qa_contact = '253' 

根据您的缺失值更新表,其中一个表。