我有四个名为tbl_attribute
,tbl_attribute_value
,tbl_product_attr_value
请找到我的sql架构
CREATE TABLE `tbl_attribute_value` (
`attr_value_id` int(20) NOT NULL,
`attr_id` int(20) NOT NULL,
`value` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_attribute_name` (
`id` int(20) UNSIGNED NOT NULL,
`attribute_name` varchar(256) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_product_attribute_value` (
`product_attr_val_id` int(20) NOT NULL,
`product_id` int(20) NOT NULL,
`attribute_value_id` int(20) NOT NULL,
`independent_values` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL,
`sequence` int(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
see http://sqlfiddle.com/#!9/7f35c (no data)
我想做的只是将当前结果转换为
product_id| (attribute_name)Film |(attribute_name)Year