/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php
クラス:SC_DB_DBFactory_MYSQL
メソッド:viewToSubQuery()
上記メソッドで返している配列のうち、キー'vw_products_allclass'に割り当てられた要素を以下のように変更。
366~437
"vw_products_allclass" => '
(SELECT T1.product_id,
product_code_min,
product_code_max,
price01_min,
price01_max,
price02_min,
price02_max,
stock_min,
stock_max,
stock_unlimited_min,
stock_unlimited_max,
del_flg,
status,
name,
comment1,
comment2,
comment3,
main_list_comment,
main_image,
main_list_image,
product_flag,
deliv_date_id,
sale_limit,
point_rate,
sale_unlimited,
create_date,
deliv_fee,
rank
,(SELECT rank AS category_rank
FROM dtb_category AS T4
WHERE T1.category_id = T4.category_id) as category_rank
,(SELECT category_id AS sub_category_id
FROM dtb_category T4
WHERE T1.category_id = T4.category_id) as category_id
FROM (SELECT T0.product_id,
T0.del_flg,
T0.status,
T0.name,
T0.comment1,
T0.comment2,
T0.comment3,
T0.main_list_comment,
T0.main_image,
T0.main_list_image,
T0.product_flag,
T0.deliv_date_id,
T0.sale_limit,
T0.point_rate,
T0.sale_unlimited,
T0.create_date,
T0.deliv_fee,
T00.category_id,
T00.rank
FROM dtb_products AS T0
LEFT JOIN dtb_product_categories AS T00
USING (product_id)) AS T1
RIGHT JOIN (SELECT product_id as product_id_sub,
MIN(product_code) AS product_code_min,
MAX(product_code) AS product_code_max,
MIN(price01) AS price01_min,
MAX(price01) AS price01_max,
MIN(price02) AS price02_min,
MAX(price02) AS price02_max,
MIN(stock) AS stock_min,
MAX(stock) AS stock_max,
MIN(stock_unlimited) AS stock_unlimited_min,
MAX(stock_unlimited) AS stock_unlimited_max
FROM dtb_products_class GROUP BY product_id) AS T2
ON T1.product_id = T2.product_id_sub
) ',
上記を以下に変更↓
"vw_products_allclass" => '
( SELECT
T1.product_id,
product_code_min,
product_code_max,
price01_min,
price01_max,
price02_min,
price02_max,
stock_min,
stock_max,
stock_unlimited_min,
stock_unlimited_max,
T1.del_flg,
status,
name,
comment1,
comment2,
comment3,
main_list_comment,
main_image,
main_list_image,
product_flag,
deliv_date_id,
sale_limit,
point_rate,
sale_unlimited,
T1.create_date,
deliv_fee,
T1.rank,
T4.category_rank,
T4.category_id
FROM
(
SELECT *
FROM
(
SELECT
product_id,
MIN(product_code) AS product_code_min,
MAX(product_code) AS product_code_max,
MIN(price01) AS price01_min,
MAX(price01) AS price01_max,
MIN(price02) AS price02_min,
MAX(price02) AS price02_max,
MIN(stock) AS stock_min,
MAX(stock) AS stock_max,
MIN(stock_unlimited) AS stock_unlimited_min,
MAX(stock_unlimited) AS stock_unlimited_max
FROM dtb_products_class
GROUP BY product_id
) AS T0
LEFT JOIN dtb_products USING (product_id)
) AS T1
INNER JOIN
(
SELECT
T2.product_id,
MAX(T2.category_id) AS category_id,
MAX(T3.rank) AS category_rank
FROM dtb_product_categories T2
INNER JOIN dtb_category T3 USING (category_id)
GROUP BY product_id
) AS T4
USING (product_id)
)',
クラス:SC_DB_DBFactory_MYSQL
メソッド:viewToSubQuery()
上記メソッドで返している配列のうち、キー'vw_products_allclass'に割り当てられた要素を以下のように変更。
366~437
"vw_products_allclass" => '
(SELECT T1.product_id,
product_code_min,
product_code_max,
price01_min,
price01_max,
price02_min,
price02_max,
stock_min,
stock_max,
stock_unlimited_min,
stock_unlimited_max,
del_flg,
status,
name,
comment1,
comment2,
comment3,
main_list_comment,
main_image,
main_list_image,
product_flag,
deliv_date_id,
sale_limit,
point_rate,
sale_unlimited,
create_date,
deliv_fee,
rank
,(SELECT rank AS category_rank
FROM dtb_category AS T4
WHERE T1.category_id = T4.category_id) as category_rank
,(SELECT category_id AS sub_category_id
FROM dtb_category T4
WHERE T1.category_id = T4.category_id) as category_id
FROM (SELECT T0.product_id,
T0.del_flg,
T0.status,
T0.name,
T0.comment1,
T0.comment2,
T0.comment3,
T0.main_list_comment,
T0.main_image,
T0.main_list_image,
T0.product_flag,
T0.deliv_date_id,
T0.sale_limit,
T0.point_rate,
T0.sale_unlimited,
T0.create_date,
T0.deliv_fee,
T00.category_id,
T00.rank
FROM dtb_products AS T0
LEFT JOIN dtb_product_categories AS T00
USING (product_id)) AS T1
RIGHT JOIN (SELECT product_id as product_id_sub,
MIN(product_code) AS product_code_min,
MAX(product_code) AS product_code_max,
MIN(price01) AS price01_min,
MAX(price01) AS price01_max,
MIN(price02) AS price02_min,
MAX(price02) AS price02_max,
MIN(stock) AS stock_min,
MAX(stock) AS stock_max,
MIN(stock_unlimited) AS stock_unlimited_min,
MAX(stock_unlimited) AS stock_unlimited_max
FROM dtb_products_class GROUP BY product_id) AS T2
ON T1.product_id = T2.product_id_sub
) ',
上記を以下に変更↓
"vw_products_allclass" => '
( SELECT
T1.product_id,
product_code_min,
product_code_max,
price01_min,
price01_max,
price02_min,
price02_max,
stock_min,
stock_max,
stock_unlimited_min,
stock_unlimited_max,
T1.del_flg,
status,
name,
comment1,
comment2,
comment3,
main_list_comment,
main_image,
main_list_image,
product_flag,
deliv_date_id,
sale_limit,
point_rate,
sale_unlimited,
T1.create_date,
deliv_fee,
T1.rank,
T4.category_rank,
T4.category_id
FROM
(
SELECT *
FROM
(
SELECT
product_id,
MIN(product_code) AS product_code_min,
MAX(product_code) AS product_code_max,
MIN(price01) AS price01_min,
MAX(price01) AS price01_max,
MIN(price02) AS price02_min,
MAX(price02) AS price02_max,
MIN(stock) AS stock_min,
MAX(stock) AS stock_max,
MIN(stock_unlimited) AS stock_unlimited_min,
MAX(stock_unlimited) AS stock_unlimited_max
FROM dtb_products_class
GROUP BY product_id
) AS T0
LEFT JOIN dtb_products USING (product_id)
) AS T1
INNER JOIN
(
SELECT
T2.product_id,
MAX(T2.category_id) AS category_id,
MAX(T3.rank) AS category_rank
FROM dtb_product_categories T2
INNER JOIN dtb_category T3 USING (category_id)
GROUP BY product_id
) AS T4
USING (product_id)
)',
#
by yoshiomi5337
| 2009-05-03 22:01
| IT