Mysql UPDATE根据多个表选择数据

时间:2012-11-13 07:37:45

标签: mysql sql phpmyadmin

我编写了一个SELECT查询来选择特定值,基本上它只选择所有3个表中的数据。

但是当我尝试更新时,它仍然会更新比应该更多的数据(行)

这是选择

SELECT 
    i.id, i.group_id, i.name, u.item, u.value, u.shows, u.nr, u.type
FROM 
    items AS i
INNER JOIN 
    item_groups, item_properties2 AS u ON item_groups.id = i.group_id
WHERE 
    item_groups.idp = '1140503406'
    AND i.id = u.item
    AND u.type = 1140614900
LIMIT 
    30, 3000 

这里是UPDATE

UPDATE item_properties2 AS P
INNER JOIN items ON items.id = P.item
INNER JOIN item_groups ON item_groups.idp = '1140503406'
SET P.nr = '0'
WHERE
    P.type = 1140614900`

它似乎忽略了我的item_groups.idp ='1140503406',而是更新其中的所有内容,而不仅仅是此值。我不知道如何理解它只应更新数据,如果它的item_groups.idp ='1140503406'而不是所有item_groups.idp。

HELP

示例数据

CREATE TABLE IF NOT EXISTS `item_groups` (
  `id` int(11) NOT NULL default '0',
  `idp` int(11) default '0',
  `text_id` int(10) unsigned default NULL,
  `name` text NOT NULL,
  `nr` int(11) default '0',
  `title` text,
  `description` text,
  `keywords` text,
  `seo_title` text,
  `seo_description` text,
  `seo_keywords` text,
  `active` tinyint(1) unsigned NOT NULL default '1',
  `type` tinyint(2) unsigned NOT NULL default '0',
  `ord_alias` varchar(128) NOT NULL default '',
  `another_title` text NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `idp` (`idp`)
) TYPE=MyISAM;





(1339999485, 1306487541, 0, 'Scandomestic||||||||{lv}', 20, NULL, '||||||||{lv}', NULL, 'Šaldytuvai vitrinos, šaldymo vitrinos, šaldytuvas vitrina, šaldymo vitrina||||||||{lv}', 'Šaldytuvai vitrinos, šaldymo vitrinos, Šalna — šaldytuvai pramonei, šaldikliai pramonei, šaldymo skrynios, šaldytuvai vitrinos, šaldymo vitrinos, šaldymo spintos, Minsk, Polair, Snaige||||||||{lv}', 'Šaldytuvai vitrinos, šaldymo vitrinos, Šalna, šaldytuvai pramonei, šaldikliai pramonei, šaldymo skrynios, šaldytuvai vitrinos, šaldymo vitrinos, šaldymo spintos, Minsk, Polair, Snaige||||||||{lv}', 1, 0, '003_003_009_020', '||||||||{lv}'),
(1340000121, 1273586684, 0, 'Šaldymo stalai||Refrigeration tables||??????????? ???????||||{lv}Saldešanas galdi', 6, NULL, '||||||||{lv}', NULL, 'Šaldymo stalai, šaldymo stalai||||||||{lv}', 'Šaldymo stalai, Šalna — šaldytuvai pramonei, šaldikliai pramonei, šaldymo skrynios, šaldytuvai vitrinos, šaldymo vitrinos, šaldymo spintos, Electrolux, Liebherr, Whirlpool, šaldymo iranga, šaldymo kameros, šaldymo vitrinos||||||||{lv}', 'šaldymo iranga, Šaldymo skrynios, Šalna, šaldytuvai pramonei, šaldikliai pramonei, šaldymo skrynios, šaldytuvai vitrinos, šaldymo vitrinos, šaldymo spintos, Electrolux, Liebherr, Whirlpool, šaldymo iranga, šaldymo kameros, šaldymo vitrinos||||||||{lv}', 1, 2, '003_006', '||||||||{lv}'),
(1340114091, 1140503406, 0, 'Panasonic||||||||{lv}', 45, NULL, '||||||||{lv}', NULL, '||||||||{lv}', '||||||||{lv}', '||||||||{lv}', 1, 0, '002_001_045', '||||||||{lv}'),
(1340351314, 1339500892, 0, 'Mawi||Mawi||Mawi||||{lv}Mawi', 209, NULL, '||||||||{lv}', NULL, '||||||||{lv}', '||||||||{lv}', '||||||||{lv}', 1, 2, '003_004_018_209', '||||||||{lv}'),
(1340687392, 1140503406, 0, 'UPO||||||||{lv}', 47, NULL, '||||||||{lv}', NULL, 'Sharp||Sharp||Sharp||||{lv}', 'Sharp šaldytuvas-šaldiklis||Sharp fridges||Sharp||||{lv}', 'Sharp, šaldytuvas, šaldytuvai, šaldikliai, šaldiklis, šaldymo iranga, šaldymo iranga buiciai||Sharp, fridges, freezers||Sharp||||{lv}', 1, 0, '002_001_047', '||||||||{lv}');

DROP TABLE IF EXISTS `item_properties2`;

CREATE TABLE IF NOT EXISTS `item_properties2` (
  `id` int(11) NOT NULL auto_increment,
  `type` int(11) default NULL,
  `item` int(11) default NULL,
  `value` text,
  `shows` int(11) default NULL,
  `nr` int(11) default NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=78180 ;

-

- 转储表item_properties2

的数据
INSERT INTO `item_properties2` (`id`, `type`, `item`, `value`, `shows`, `nr`) VALUES
(44774, 1140614843, 1146145783, '30', 0, 6),
(44775, 1140764279, 1146145783, '+1°C - +65°C', 1, 7),
(44776, 1140614891, 1146145783, 'Deže (išore ir vidus): šviesiai pilka/tamsiai pilka; dangtis: šviesiai pilka.', 1, 8),
(42360, 1140614891, 1242137094, 'Nerudijancio plieno', 1, 8),
(42361, 1140614900, 1242137094, 'Japonija', 1, 9),
(46368, 1140764407, 1209560120, 'Erdve 2l buteliui, šaldytuvas gali buti pastatomas vertikaliai, šaldymo - šildymo funkcijos.', 1, 10),
(44874, 1140614900, 1250520801, 'Vokietija', 1, 9),
(46380, 1146127137, 1277976190, 'Waeco CoolMatic CDF-035', 0, 0),
(46367, 1140614900, 1209560120, 'Vokietija', 1, 9),
(46366, 1140614891, 1209560120, 'Juoda / balta', 1, 8),
(44730, 1140614900, 1146144811, 'Vokietija', 1, 9),
(44728, 1140614891, 1146144811, 'Deže (išore ir vidus): šviesiai pilka, dangtis: tamsiai pilka', 1, 8),
(44727, 1140764279, 1146144811, '+1°C - +65°C', 1, 7),
(44726, 1140614843, 1146144811, '19', 0, 6),
(44725, 1140614826, 1146144811, '33', 0, 5),
(44724, 1140614802, 1146144811, '28', 0, 4),
(44723, 1157531440, 1146144811, '36 W', 0, 3),
(44721, 1140614775, 1146144811, '12/230 voltu DC/AC', 0, 1),
(44669, 1140764407, 1146140235, 'Šviesa viduje, elektroninis valdymas, patogios rankenos nešimui, erdve 2 l buteliui, išimamas metalinis krepšys', 1, 10),
(44668, 1140614900, 1146140235, 'Vokietija', 1, 9),
(44665, 1140764279, 1146140235, '+10 iki -18 (nustatoma elektroniniu termostatu)', 1, 7),
(44666, 1140614891, 1146140235, 'Tamsiai/šviesiai pilka', 1, 8),
(78120, 1140614792, 1352201554, '327', 1, 5),
(25927, 1140614900, 1176359569, 'USA', 0, 7),
(25926, 1141204836, 1176359569, 'yra', 0, 6),
(44664, 1140614843, 1146140235, '58', 0, 6),
(44653, 1140614900, 1146137735, 'Vokietija', 1, 9),
(44651, 1140614891, 1146137735, 'Tamsiai/šviesiai pilka', 1, 8),
(44648, 1140614826, 1146137735, '36', 0, 5),
(44647, 1140614802, 1146137735, '38,5', 0, 4),
(44707, 1146127137, 1207641727, 'Waeco Coolfreeze CF-110 AC', 0, 0),
(44682, 1140764407, 1207639997, 'Šviesa viduje, elektroninis valdymas, nuimamos rankenos nešimui, erdve 2 l buteliui', 1, 10),
(44680, 1140614900, 1207639997, 'Vokietija', 1, 9),
(44679, 1140614891, 1207639997, 'pilka', 1, 8),
(44678, 1140764279, 1207639997, '+10 iki -18', 1, 7),
(44677, 1140614843, 1207639997, '63', 0, 6),
(44676, 1140614826, 1207639997, '36', 0, 5),
(44675, 1140614802, 1207639997, '48', 0, 4),
(44674, 1157531440, 1207639997, 'Vidut. 45W', 0, 3),
(44673, 1140614792, 1207639997, '49', 0, 2),
(22032, 1140764407, 1146135011, 'Patogi rankena, mechaninis valdymas', 1, 10),
(22029, 1140614891, 1146135011, 'Tamsiai/šviesiai pilka', 1, 8),
(22031, 1140614900, 1146135011, 'Vokietija', 1, 9),
(22007, 1140764407, 1146133201, 'DC pajungimo laidas', 1, 10),
(22006, 1140614900, 1146133201, 'Vokietija', 1, 9),
(22028, 1140764279, 1146135011, '+10 iki -18 (nustatoma elektroniniu termostatu)', 1, 7),
(22027, 1140614843, 1146135011, '46.5', 0, 6),
(22026, 1140614826, 1146135011, '30', 0, 5),
(22025, 1140614802, 1146135011, '41.4', 0, 4),
(22004, 1140614891, 1146133201, 'Tamsiai/šviesiai pilka', 1, 8),
(22003, 1140764279, 1146133201, 'nuo +10 iki -18 (nustatoma elektroniniu termostatu)', 1, 7),
(22002, 1140614843, 1146133201, '56', 0, 6),
(22001, 1140614826, 1146133201, '34', 0, 5),
(22000, 1140614802, 1146133201, '47.5', 0, 4),
(21999, 1157531440, 1146133201, 'Vidut. 45W', 0, 3),
(21998, 1140614792, 1146133201, '39', 0, 2),
(46390, 1140764407, 1277976190, 'Šviesa viduje, elektroninis valdymas, patogios rankenos nešimui, erdve 2 l buteliui, išimamas metalinis krepšys', 1, 10),
(21997, 1140614775, 1146133201, '12/24 DC', 0, 1),
(46389, 1140614900, 1277976190, 'Vokietija', 1, 9),
(46388, 1140614891, 1277976190, 'Tamsiai/šviesiai pilka', 1, 8),
(46387, 1140764279, 1277976190, '+10 iki -18 (nustatomas elektroniniu termostatu)', 1, 7),
(42201, 1140764407, 1224489821, '', 1, 8),
(46110, 1140764407, 1140784557, '1 durys, 6 stalciai', 1, 11),
(42066, 1140614900, 1140784557, 'Baltarusija', 1, 9),
(42067, 1140614900, 1140784557, 'Baltarusija', 1, 10),
(46386, 1140614843, 1277976190, '56', 0, 6),
(46385, 1140614826, 1277976190, '34', 0, 5),
(46383, 1157531440, 1277976190, 'Vidut. 45 W', 0, 3),
(42065, 1140614891, 1140784557, 'balta', 1, 8),
(43302, 1140614900, 1140788581, 'Lietuva', 1, 9),
(43471, 1140614900, 1140790207, 'Lietuva', 1, 9),
(43470, 1140614891, 1140790207, 'balta', 1, 8),
(43469, 1140771001, 1140790207, '245', 1, 7),
(43468, 1140784675, 1140790207, '-', 1, 6),
(43467, 1140614792, 1140790207, '245', 1, 5),
(43466, 1140614843, 1140790207, '60', 0, 4),
(43465, 1140614826, 1140790207, '60', 0, 3),
(43464, 1140614802, 1140790207, '145', 0, 2),
(43463, 1140770892, 1140790207, '0.73', 0, 1),
(43462, 1140614720, 1140790207, 'A', 0, 0),
(53894, 1140771001, 1304447043, '-', 1, 7),
(43448, 1140614900, 1140789961, 'Lietuva', 1, 9),
(43447, 1140614891, 1140789961, 'Balta', 1, 8),
(43446, 1140771001, 1140789961, '100', 1, 7),
(43445, 1140784675, 1140789961, '-', 1, 6),
(43444, 1140614792, 1140789961, '100', 1, 5),
(43443, 1140614843, 1140789961, '60', 0, 4),
(43442, 1140614826, 1140789961, '56', 0, 3),
(43441, 1140614802, 1140789961, '85', 0, 2),
(43460, 1140614900, 1140786679, 'Lietuva', 1, 9),
(43459, 1140614891, 1140786679, 'balta', 1, 8),
(43458, 1140771001, 1140786679, '245', 1, 7),
(43457, 1140784675, 1140786679, '-', 1, 6),
(43456, 1140614792, 1140786679, '245', 1, 5),
(43455, 1140614843, 1140786679, '60', 0, 4),
(43454, 1140614826, 1140786679, '60', 0, 3),
(43453, 1140614802, 1140786679, '145', 0, 2),
(43452, 1140770892, 1140786679, '0.73', 0, 1),
(43451, 1140614720, 1140786679, 'A', 0, 0),
(23707, 1140614900, 1140786959, 'Italija ', 1, 10),
(23706, 1140614891, 1140786959, 'balta ', 1, 9),
(23705, 1140771001, 1140786959, '140 ', 1, 8),
(23704, 1140784675, 1140786959, '-', 1, 7),
(23703, 1140614792, 1140786959, '140 ', 1, 6),
(23702, 1140614843, 1140786959, '60 ', 0, 5),
(23701, 1140614826, 1140786959, '60 ', 0, 4),
(23700, 1140614802, 1140786959, '105 ', 0, 3),
(23699, 1140770892, 1140786959, '0.84 ', 0, 2),
(23698, 1140614720, 1140786959, 'B ', 0, 1),
(23696, 1140614909, 1140787174, 'Rusija ', 1, 11),
(23695, 1140614900, 1140787174, 'Italija ', 1, 10),
(23694, 1140614891, 1140787174, 'balta ', 1, 9),
(23693, 1140771001, 1140787174, '275 ', 1, 8),
(23692, 1140784675, 1140787174, '-', 1, 7),
(23691, 1140614792, 1140787174, '275 ', 1, 6),
(23690, 1140614843, 1140787174, '60 ', 0, 5),
(23689, 1140614826, 1140787174, '60 ', 0, 4),
(23688, 1140614802, 1140787174, '167 ', 0, 3),
(23687, 1140770892, 1140787174, '1.1 ', 0, 2),
(23686, 1140614720, 1140787174, 'B ', 0, 1),
(23717, 1140614891, 1140787419, 'balta ', 1, 9),
(23716, 1140771001, 1140787419, '275 ', 1, 8),
(23715, 1140784675, 1140787419, '-', 1, 7),
(23714, 1140614792, 1140787419, '275 ', 1, 6),
(23713, 1140614843, 1140787419, '60 ', 0, 5),
(23712, 1140614826, 1140787419, '60 ', 0, 4),
(23711, 1140614802, 1140787419, '167 ', 0, 3),
(23710, 1140770892, 1140787419, '1.1 ', 0, 2),
(23709, 1140614720, 1140787419, 'B ', 0, 1),
(43785, 1140764407, 1159857676, 'Plasmacluster technologija, greito šaldymo funkcija.', 1, 10),
(43783, 1140614900, 1159857676, 'Japonija', 1, 9),
(43782, 1140614891, 1159857676, 'Sidabro', 1, 8),
(43781, 1140771001, 1159857676, '215', 1, 7),
(43780, 1140784675, 1159857676, '358', 1, 6),
(41632, 1140614900, 1140787900, 'Kinija', 1, 8),
(41631, 1140614891, 1140787900, 'balta||white', 1, 7),
(41630, 1140771001, 1140787900, '-', 1, 6),
(41629, 1140784675, 1140787900, '-', 1, 5),
(41628, 1140614792, 1140787900, '45', 1, 4),
(41627, 1140614826, 1140787900, '44', 0, 3),
(41626, 1140614802, 1140787900, '82', 0, 2),
(41625, 1140770892, 1140787900, '0.8', 0, 1),
(41624, 1140614720, 1140787900, 'A', 0, 0),
(42079, 1140764407, 1140788111, '1 durys, tik šaldytuvas be šaldiklio.', 1, 10),
(42077, 1140614900, 1140788111, 'Baltarusija', 1, 9),
(42076, 1140614891, 1140788111, 'Balta', 1, 8),
(42075, 1140771001, 1140788111, '-', 1, 7),
(42074, 1140784675, 1140788111, '285', 1, 6),
(42073, 1140614792, 1140788111, '285', 1, 5),
(42072, 1140614843, 1140788111, '60', 0, 4),
(42071, 1140614826, 1140788111, '60', 0, 3),
(42070, 1140614802, 1140788111, '150', 0, 2),
(42759, 1140614900, 1140788367, 'Lietuva', 1, 9),
(42758, 1140614891, 1140788367, 'balta', 1, 8),
(42757, 1140771001, 1140788367, '-', 1, 7),
(42756, 1140784675, 1140788367, '127', 1, 6),
(42755, 1140614792, 1140788367, '127', 1, 5),
(42754, 1140614843, 1140788367, '60', 0, 4),
(42753, 1140614826, 1140788367, '56', 0, 3),
(43293, 1140614720, 1140788581, 'A', 0, 0),
(43294, 1140770892, 1140788581, '0.46', 0, 1),
(43301, 1140614891, 1140788581, 'balta', 1, 8),
(43300, 1140771001, 1140788581, '-', 1, 7),
(43299, 1140784675, 1140788581, '275', 1, 6),
(42191, 1140614900, 1140788826, 'Baltarusija', 1, 9),
(42190, 1140614891, 1140788826, 'balta', 1, 8),
(42189, 1140771001, 1140788826, '115', 1, 7),
(42188, 1140784675, 1140788826, '220', 1, 6),
(42187, 1140614792, 1140788826, '335', 1, 5),
(42186, 1140614843, 1140788826, '60', 0, 4),
(42185, 1140614826, 1140788826, '60', 0, 3),
(42184, 1140614802, 1140788826, '176', 0, 2),
(42179, 1140614900, 1140789085, 'Baltarusija', 1, 9),
(42178, 1140614891, 1140789085, 'balta', 1, 8),
(42177, 1140771001, 1140789085, '80', 1, 7),
(42176, 1140784675, 1140789085, '268', 1, 6),
(42175, 1140614792, 1140789085, '348', 1, 5),
(42174, 1140614843, 1140789085, '60', 0, 4),
(43522, 1140614891, 1140789239, 'balta ', 1, 9),
(43521, 1140771001, 1140789239, '- ', 1, 8),
(43520, 1140784675, 1140789239, '245 ', 1, 7),
(43519, 1140614792, 1140789239, '245 ', 1, 6),
(43518, 1140614843, 1140789239, '60 ', 0, 5),
(43517, 1140614826, 1140789239, '60 ', 0, 4),
(43516, 1140614802, 1140789239, '131 ', 0, 3),
(43515, 1140770892, 1140789239, '1,2 ', 0, 2),
(43514, 1140614720, 1140789239, 'B ', 0, 1),
(46661, 1140614826, 1283262225, '', 1, 1),
(41743, 1140784675, 1224573246, '106', 1, 6),
(43500, 1140614900, 1228469272, 'Vokietija', 1, 9),
(28009, 1140614900, 1140790832, 'Italija ', 1, 10),
(28008, 1140614891, 1140790832, 'balta ', 1, 9),
(28007, 1140771001, 1140790832, '40 ', 1, 8),
(28006, 1140784675, 1140790832, '178 ', 1, 7),
(28005, 1140614792, 1140790832, '218 ', 1, 6),
(28004, 1140614843, 1140790832, '57 ', 0, 5),
(28003, 1140614826, 1140790832, '50 ', 0, 4),
(28002, 1140614802, 1140790832, '154 ', 0, 3),
(28001, 1140770892, 1140790832, '0.75 ', 0, 2),
(28000, 1140614720, 1140790832, 'A ', 0, 1),
(40313, 0, 1141202290, '', 0, 6),
(41145, 1140614900, 1221565412, 'Vokietija', 1, 9),
(41280, 1140614900, 1222331102, 'Italija', 1, 9),
(41124, 1140614900, 1140791004, 'Italija', 1, 9),
(41123, 1140614891, 1140791004, 'gelsva', 1, 8),
(41122, 1140771001, 1140791004, '83', 1, 7),
(41121, 1140784675, 1140791004, '218', 1, 6),
(41120, 1140614792, 1140791004, '301', 1, 5),
(41119, 1140614843, 1140791004, '65', 0, 4),
(41118, 1140614826, 1140791004, '60', 0, 3),
(41117, 1140614802, 1140791004, '188', 0, 2),
(28047, 1140614909, 1140791385, 'Italija ', 1, 11),
(28046, 1140614900, 1140791385, 'Italija ', 1, 10),
(28045, 1140614891, 1140791385, 'balta ', 1, 9),
(28044, 1140771001, 1140791385, '35 ', 1, 8),
(28043, 1140784675, 1140791385, '179 ', 1, 7),
(28042, 1140614792, 1140791385, '214 ', 1, 6),
(28041, 1140614843, 1140791385, '58 ', 0, 5),
(28040, 1140614826, 1140791385, '50 ', 0, 4),
(28039, 1140614802, 1140791385, '141 ', 0, 3),
(28038, 1140770892, 1140791385, '0.75 ', 0, 2),
(28037, 1140614720, 1140791385, 'A ', 0, 1),
(28036, 1140764407, 1140791820, '\\"automatinis šaldytuvo atitirpinimas, kamera viršuje\\"', 1, 12),
(28035, 1140614909, 1140791820, 'Italija ', 1, 11),
(28034, 1140614900, 1140791820, 'Italija ', 1, 10),
(28033, 1140614891, 1140791820, 'inox ', 1, 9),
(28032, 1140771001, 1140791820, '49 ', 1, 8),
(28031, 1140784675, 1140791820, '194 ', 1, 7),
(28030, 1140614792, 1140791820, '243 ', 1, 6),
(28029, 1140614843, 1140791820, '58 ', 0, 5),
(28028, 1140614826, 1140791820, '55 ', 0, 4),
(28027, 1140614802, 1140791820, '141 ', 0, 3),
(28026, 1140770892, 1140791820, '1.1 ', 0, 2),
(28025, 1140614720, 1140791820, 'B ', 0, 1),
(28059, 1140614909, 1140791988, 'Italija ', 1, 11),
(28058, 1140614900, 1140791988, 'Italija ', 1, 10),
(28057, 1140614891, 1140791988, 'inox ', 1, 9),
(28056, 1140771001, 1140791988, '55 ', 1, 8),
(28055, 1140784675, 1140791988, '216 ', 1, 7),
(28054, 1140614792, 1140791988, '271 ', 1, 6),
(28053, 1140614843, 1140791988, '58 ', 0, 5),
(28052, 1140614826, 1140791988, '54 ', 0, 4),
(28051, 1140614802, 1140791988, '154 ', 0, 3),
(28050, 1140770892, 1140791988, '0.8 ', 0, 2),
(35415, 1140764407, 1140792326, 'automatinis šaldytuvo atitirpinimas, šaldiklis - \\"no frost\\"', 1, 12),
(35414, 1140614909, 1140792326, 'Turkija ', 1, 11),
(35413, 1140614900, 1140792326, 'Turkija ', 1, 10),
(35412, 1140614891, 1140792326, 'balta ', 1, 9),
(35411, 1140771001, 1140792326, '96 ', 1, 8),
(35410, 1140784675, 1140792326, '162 ', 1, 7),
(35409, 1140614792, 1140792326, '258 ', 1, 6),
(23595, 0, 1140792462, '', 0, 14);


CREATE TABLE IF NOT EXISTS `item_property_groups2` (
  `id` int(11) NOT NULL default '0',
  `name` text,
  `unit` text,
  `nr` tinyint(4) default '0',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;

-

- 转储表item_property_groups2

的数据
INSERT INTO `item_property_groups2` (`id`, `name`, `unit`, `nr`) VALUES
(1140614720, 'Energijos klasė||Energy Class||Класс электронергии||Energijos klasė||{lv}Enerģijas klase', '||||||||{lv}', 9),
(1140614775, 'El. įtampa||Voltage||Эл. напряжение||El. įtampa||{lv}Elektriskais spriegums', '||||||||{lv}', 11),
(1140614792, 'Bendras tūris, L||Total capacity, L||Общий объем, Л||Bendras tūris||{lv}Kopējais apjoms (litri)', 'litrai||litrai||litrai||litrai||{lv}litri', 4),
(1140614802, 'Aukštis (cm.)||Height||Высота (см)||Aukštis||{lv}Augstums (cm)', 'cm||cm||cm||cm||{lv}cm', 1),
(1140614826, 'Plotis (cm.)||Width (cm.)||Ширина  (см.)||Plotis||{lv}Platums (cm)', 'cm||cm||cm||cm||{lv}cm', 37),
(1140614843, 'Gylis (cm)||Depth (cm)||Глубина (см)||Gylis||{lv}Dziļums (cm)', 'cm||cm||cm||cm||{lv}cm', 16),
(1140614891, 'Spalva||Color||Цвет||Farbe||{lv}Krāsa', '||||||||{lv}', 38),
(1140614900, 'Gamintojas||Producer||Производитель||Gamintojas||{lv}Ražotājs', '||||||||{lv}', 24);

1 个答案:

答案 0 :(得分:1)

将谓词items_groups.idp = '1140503406'移至WHERE子句,使用JOIN条件item_groups.idp = items.group_id代替它,如下所示:

UPDATE item_properties2 AS P
INNER JOIN items ON items.id = P.item
INNER JOIN item_groups ON item_groups.idp = items.group_id 
SET P.nr = '0'
WHERE P.type = 1140614900
  AND items_groups.idp = '1140503406';