source: temp/trunk/html/test/kakinaka/mysql.php @ 4760

Revision 4760, 1.7 KB checked in by kakinaka, 20 years ago (diff)

blank

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2require_once './DB.php'; // PEAR ¤Î DB ¥¯¥é¥¹¤òÆÉ¤ß¹þ¤à
3
4print("start<br>");
5/*
6$dsn = "mysql://eccube_db_user:[email protected]/eccube_db";
7print($dsn."<br>");
8
9if(($db = DB::connect($dsn)) == 0){
10  print "¤ª¤ª¤Ã¤È¡ª¥Ç¡¼¥¿¥Ù¡¼¥¹¤ËÀܳ¤Ç¤­¤Þ¤»¤ó¡£";
11}
12$result = $db->query("select * from dtb_baseinfo");
13while($row = $result->fetchRow()){
14    print_r($row);
15}
16
17*/
18
19$sql = '
20        (SELECT
21        product_id,
22        product_code_min,
23        product_code_max,
24        price01_min,
25        price01_max,
26        price02_min,
27        price02_max,
28        stock_min,
29        stock_max,
30        stock_unlimited_min,
31        stock_unlimited_max,
32        del_flg,
33        status,
34        name,
35        comment1,
36        comment2,
37        comment3,
38        rank,
39        main_list_comment,
40        main_image,
41        main_list_image,
42        product_flag,
43        deliv_date_id,
44        sale_limit,
45        point_rate,
46        sale_unlimited,
47        create_date,
48        deliv_fee
49        ,(SELECT rank AS category_rank FROM dtb_category AS T4 WHERE T1.category_id = T4.category_id)
50        ,(SELECT category_id AS sub_category_id FROM dtb_category T4 WHERE T1.category_id = T4.category_id)
51    FROM
52        dtb_products 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
53    ) vw_products_allclass ';
54   
55print(preg_replace("/[\r\n\t]/","",$sql));
56
57print("end");
58
59?>
Note: See TracBrowser for help on using the repository browser.