Ich habe eine Tabelle im Namen von ips wie folgt:
CREATE TABLE `ips` (
`id` int(10) unsigned NOT NULL DEFAULT '0',
`begin_ip_num` int(11) unsigned DEFAULT NULL,
`end_ip_num` int(11) unsigned DEFAULT NULL,
`iso` varchar(3) DEFAULT NULL,
`country` varchar(150) DEFAULT NULL
) ENGINE=InnoDB
Nehmen wir an, ich habe countryidin dieser Tabelle ein Feld aus der nachstehenden Ländertabelle:
CREATE TABLE `country` (
`countryid` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`ordering` smallint(5) unsigned NOT NULL DEFAULT '0',
`iso` char(2) NOT NULL,
PRIMARY KEY (`countryid`)
) ENGINE=InnoDB
Es gibt ungefähr 100.000 Datensätze in der IPS-Tabelle. Gibt es eine Abfrage für das folgende Szenario vor :
Überprüfen Sie, ob ips.isogleich country.iso, wenn es gleich ist dann zu diesem Eintrag country.coutryid hinzufügen. Ich konnte mir keine Möglichkeit vorstellen, das zu tun. Hast du eine Idee, wie das geht?