source: branches/version-2_5-dev/html/install/sql/create_view.sql @ 18876

Revision 18876, 3.1 KB checked in by Seasoft, 12 years ago (diff)

#628(未使用処理・定義の削除)

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