| 1 | CREATE VIEW vw_products_allclass_detail AS |
|---|
| 2 | SELECT |
|---|
| 3 | dtb_products.product_id, |
|---|
| 4 | dtb_products."name", |
|---|
| 5 | dtb_products.maker_id, |
|---|
| 6 | dtb_products.status, |
|---|
| 7 | dtb_products.comment1, |
|---|
| 8 | dtb_products.comment2, |
|---|
| 9 | dtb_products.comment3, |
|---|
| 10 | dtb_products.comment4, |
|---|
| 11 | dtb_products.comment5, |
|---|
| 12 | dtb_products.comment6, |
|---|
| 13 | dtb_products.note, |
|---|
| 14 | dtb_products.main_list_comment, |
|---|
| 15 | dtb_products.main_list_image, |
|---|
| 16 | dtb_products.main_comment, |
|---|
| 17 | dtb_products.main_image, |
|---|
| 18 | dtb_products.main_large_image, |
|---|
| 19 | dtb_products.sub_title1, |
|---|
| 20 | dtb_products.sub_comment1, |
|---|
| 21 | dtb_products.sub_image1, |
|---|
| 22 | dtb_products.sub_large_image1, |
|---|
| 23 | dtb_products.sub_title2, |
|---|
| 24 | dtb_products.sub_comment2, |
|---|
| 25 | dtb_products.sub_image2, |
|---|
| 26 | dtb_products.sub_large_image2, |
|---|
| 27 | dtb_products.sub_title3, |
|---|
| 28 | dtb_products.sub_comment3, |
|---|
| 29 | dtb_products.sub_image3, |
|---|
| 30 | dtb_products.sub_large_image3, |
|---|
| 31 | dtb_products.sub_title4, |
|---|
| 32 | dtb_products.sub_comment4, |
|---|
| 33 | dtb_products.sub_image4, |
|---|
| 34 | dtb_products.sub_large_image4, |
|---|
| 35 | dtb_products.sub_title5, |
|---|
| 36 | dtb_products.sub_comment5, |
|---|
| 37 | dtb_products.sub_image5, |
|---|
| 38 | dtb_products.sub_large_image5, |
|---|
| 39 | dtb_products.sub_title6, |
|---|
| 40 | dtb_products.sub_comment6, |
|---|
| 41 | dtb_products.sub_image6, |
|---|
| 42 | dtb_products.sub_large_image6, |
|---|
| 43 | dtb_products.del_flg, |
|---|
| 44 | dtb_products.creator_id, |
|---|
| 45 | dtb_products.create_date, |
|---|
| 46 | dtb_products.update_date, |
|---|
| 47 | dtb_products.deliv_date_id, |
|---|
| 48 | T4.product_code_min, |
|---|
| 49 | T4.product_code_max, |
|---|
| 50 | T4.price01_min, |
|---|
| 51 | T4.price01_max, |
|---|
| 52 | T4.price02_min, |
|---|
| 53 | T4.price02_max, |
|---|
| 54 | T4.stock_min, |
|---|
| 55 | T4.stock_max, |
|---|
| 56 | T4.stock_unlimited_min, |
|---|
| 57 | T4.stock_unlimited_max, |
|---|
| 58 | T4.class_count |
|---|
| 59 | FROM |
|---|
| 60 | dtb_products |
|---|
| 61 | LEFT JOIN |
|---|
| 62 | ( |
|---|
| 63 | SELECT |
|---|
| 64 | product_id, |
|---|
| 65 | MIN(product_code) AS product_code_min, |
|---|
| 66 | MAX(product_code) AS product_code_max, |
|---|
| 67 | MIN(price01) AS price01_min, |
|---|
| 68 | MAX(price01) AS price01_max, |
|---|
| 69 | MIN(price02) AS price02_min, |
|---|
| 70 | MAX(price02) AS price02_max, |
|---|
| 71 | MIN(stock) AS stock_min, |
|---|
| 72 | MAX(stock) AS stock_max, |
|---|
| 73 | MIN(stock_unlimited) AS stock_unlimited_min, |
|---|
| 74 | MAX(stock_unlimited) AS stock_unlimited_max, |
|---|
| 75 | COUNT(*) as class_count |
|---|
| 76 | FROM dtb_products_class |
|---|
| 77 | GROUP BY product_id |
|---|
| 78 | ) AS T4 |
|---|
| 79 | ON dtb_products.product_id = T4.product_id |
|---|
| 80 | ; |
|---|
| 81 | |
|---|
| 82 | CREATE VIEW vw_products_allclass AS |
|---|
| 83 | SELECT |
|---|
| 84 | alldtl.*, |
|---|
| 85 | dtb_category.rank AS category_rank, |
|---|
| 86 | T2.category_id, |
|---|
| 87 | T2.rank AS product_rank |
|---|
| 88 | FROM |
|---|
| 89 | vw_products_allclass_detail AS alldtl |
|---|
| 90 | LEFT JOIN |
|---|
| 91 | dtb_product_categories AS T2 |
|---|
| 92 | ON alldtl.product_id = T2.product_id |
|---|
| 93 | LEFT JOIN |
|---|
| 94 | dtb_category |
|---|
| 95 | ON T2.category_id = dtb_category.category_id |
|---|
| 96 | ; |
|---|