我正在使用 3 API(Linkshare、commission junction 和 amazon)开发一个价格比较网站。在数据库中,表字段彼此不相关。但产品名称与其他表类似。
第 1 步:我想合并所有三个表并显示在单个表中。这可能吗?
第二步:对比三张表,在前端列出产品。
注意:我在三个表中的主键是:commission junction: SKU Amazon:aid LinkShare:SKUNUMBER
这是我的数据库结构。
我的 3API 表 DDL 结构。亚马逊表结构
CREATE TABLE `amazon` ( `aid` bigint(20) NOT NULL AUTO_INCREMENT, `network` varchar(230) NOT NULL, `merchant_id` varchar(250) NOT NULL, `merchant_name` varchar(250) NOT NULL, `merchant_logo` mediumtext NOT NULL, `name` varchar(250) NOT NULL, `brand` varchar(250) NOT NULL, `asin` varchar(250) NOT NULL, `upc` varchar(150) NOT NULL, `ean` varchar(300) NOT NULL,
`image` mediumtext NOT NULL, `description` text NOT NULL, `url` mediumtext NOT NULL, `price` decimal(10,0) NOT NULL, `listprice` decimal(10,0) NOT NULL, `lowest_usedprice` decimal(10,0) NOT NULL, `shipping` varchar(130) NOT NULL, `currency` varchar(5) NOT NULL, `search_keyword` text NOT NULL, `search_maxprice` varchar(230) NOT NULL, `search_minprice` varchar(230) NOT NULL, `date` datetime NOT NULL, `catagory` varchar(255) NOT NULL, PRIMARY KEY (`aid`)) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=latin1
委员会结点的表结构。
CREATE TABLE `cjfeeds` ( `PROGRAMNAME` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `PROGRAMURL` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL, `CATALOGNAME` varchar(130) COLLATE utf8_unicode_ci DEFAULT NULL, `LASTUPDATED` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `NAME` varchar(160) COLLATE utf8_unicode_ci DEFAULT NULL, `KEYWORDS` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL, `DESCRIPTION` varchar(3000) COLLATE utf8_unicode_ci DEFAULT NULL, `SKU` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `MANUFACTURER` varchar(160) COLLATE utf8_unicode_ci DEFAULT NULL, `MANUFACTURERID` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `UPC` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `ISBN` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
`CURRENCY` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `SALEPRICE` decimal(10,2) DEFAULT NULL, `PRICE` decimal(10,2) DEFAULT NULL, `RETAILPRICE` decimal(10,2) DEFAULT NULL,
`FROMPRICE` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `BUYURL` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL, `IMPRESSIONURL` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL, `IMAGEURL` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL, `ADVERTISERCATEGORY` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL, `THIRDPARTYID` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `THIRDPARTYCATEGORY` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL, `AUTHOR` varchar(130) COLLATE utf8_unicode_ci DEFAULT NULL, `ARTIST` varchar(130) COLLATE utf8_unicode_ci DEFAULT NULL, `TITLE` varchar(130) COLLATE utf8_unicode_ci DEFAULT NULL, `PUBLISHER` varchar(130) COLLATE utf8_unicode_ci DEFAULT NULL, `LABEL` varchar(130) COLLATE utf8_unicode_ci DEFAULT NULL, `FORMAT` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, `SPECIAL` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `GIFT` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `PROMOTIONALTEXT` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL, `STARTDATE` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `ENDDATE` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`OFFLINE` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `ONLINE` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `INSTOCK` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
`CONDITION` varchar(11) COLLATE utf8_unicode_ci DEFAULT NULL, `WARRANTY` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL, `STANDARDSHIPPINGCOST` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`SKU`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
链接共享的表结构:
CREATE TABLE `linkshare` ( `PRODUCTID` int(100) unsigned NOT NULL, `PRODUCTNAME` varchar(255) NOT NULL, `SKUNUMBER` varchar(200) NOT NULL, `PRIMARYCATAGRY` varchar(255) NOT NULL, `SECONDARYCATAGRY` varchar(2000) NOT NULL, `PRODUCTURL` varchar(2000) NOT NULL, `PRODUCTIMAGEURL` varchar(2000) NOT NULL, `BUYURL` varchar(2000) NOT NULL, `SHORTPRODUCTDESCRIPTION` varchar(2000) NOT NULL, `LONGPRODUCTDESCRIPTION` varchar(2000) NOT NULL, `DISCOUNT` float(8,2) unsigned NOT NULL,
`DISCOUNTTYPE` varchar(255) NOT NULL, `SALEPRICE` float(8,2) unsigned NOT NULL, `RETAILPRICE` float(8,2) unsigned NOT NULL,
`BEGINDATE` datetime NOT NULL, `ENDDATE` datetime NOT NULL, `BRAND` varchar(255) NOT NULL, `SHIPPING` int(255) unsigned NOT NULL, `KEYWORDS` varchar(500) NOT NULL, `MANUFACTURERPART` varchar(100) NOT NULL, `MANUFACTURERNAME` varchar(250) NOT NULL,
`SHIPPINGINFORMATION` varchar(50) NOT NULL, `AVAILABLITY` varchar(50) NOT NULL, `UNIVERSALPRODUCTCODE` varchar(15) NOT NULL,
`CLASSID` float(8,2) unsigned NOT NULL, `CURRENCY` varchar(3) NOT NULL, `M1` varchar(2000) NOT NULL, `PIXEL` varchar(255) NOT NULL, `MISCELLANEOUSATTRIBUTE` varchar(255) NOT NULL, `ATTRIBUTE1` varchar(255) NOT NULL, `ATTRIBUTE2` varchar(255) NOT NULL, `ATTRIBUTE3` varchar(255) NOT NULL, `ATTRIBUTE4` varchar(255) NOT NULL, `ATTRIBUTE5` varchar(255) NOT NULL, ATTRIBUTE6` varchar(255) NOT NULL, `ATTRIBUTE7` varchar(255) NOT NULL, `ATTRIBUTE8` varchar(255) NOT NULL, `ATTRIBUTE9` varchar(255) NOT NULL, `ATTRIBUTE10` varchar(255) NOT NULL, UNIQUE KEY `PRODUCTID` (`PRODUCTID`)) ENGINE=MyISAM DEFAULT CHARSET=utf8
我该如何解决这个问题,请给我一个有用的建议。