|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /home/queenjbs/www/test/ |
Upload File : |
<?include "$DOCUMENT_ROOT/conf/conf_dir.php";?>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<?
/*
//주문상품을 주문내역에 넣기
$QUERY_PAGE = "
select
parent,goodsuid
FROM
shop_ordergoods
group by parent
";
$result= mysql_query($QUERY_PAGE,$db_con);
$total = mysql_affected_rows();
for($i=0; $i<$total; $i++) {
$row = mysql_fetch_array($result);
echo $i." ";
echo $insert_query="update shop_order set goodsuid='$row[goodsuid]' where uid='$row[parent]'";
echo "<br/>";
//mysql_query($insert_query,$db_con);
}
echo "end";
*/
/*
//cash_cnt 캐쉬 횟수 조사
$QUERY_PAGE = "
select
a.id,
count(b.user_id) as cnt
FROM
user a JOIN user_cash b
on
a.id= b.user_id and
b.flag='D' and
a.auth_code =10 and
a.activated = 1
group by a.id
";
$result= mysql_query($QUERY_PAGE,$db_con);
$total = mysql_affected_rows();
for($i=0; $i<$total; $i++) {
$row = mysql_fetch_array($result);
echo "id : ".$row[id]." cnt :".$row[cnt]."<br>";
$insert_query="update user set cash_cnt='$row[cnt]'
where
id='$row[id]'";
mysql_query($insert_query,$db_con);
}
echo "end";
*/
//endtdate값 넣기
$QUERY_PAGE = "select a.id,
max(b.enddate) as endDate
FROM
user a JOIN user_cash b
on
a.id= b.user_id and
b.flag='D' and
a.auth_code =10 and
a.activated = 1 and
a.cash_cnt=2
group by a.id";
$result= mysql_query($QUERY_PAGE,$db_con);
echo $total = mysql_affected_rows();
for($i=0; $i<$total; $i++) {
$row = mysql_fetch_array($result);
echo "id : ".$row[id]." cnt :".$row[endDate]."<br>";
$insert_query="update user set m_enddate='$row[endDate]'
where
id='$row[id]'";
//mysql_query($insert_query,$db_con);
}
echo "end";
?>
<!--
update user set mChk='cnt'
where
id='cc'
explain
update user set mChk=(
select
count(b.user_id) as cnt
FROM
user a JOIN user_cash b
on
a.id= b.user_id and
b.flag='D' and
a.auth_code =10 and
a.activated = 1
group by a.id
)
74
select
count(b.user_id) as cnt
FROM
user a JOIN user_cash b
on
a.id= b.user_id and
b.flag='D' and
a.auth_code =10 and
a.activated = 1
group by a.id
explain
select
a.id,
count(b.user_id) as cnt
FROM
user a JOIN user_cash b
on
a.id= b.user_id and
b.flag='D' and
a.auth_code =10 and
a.activated = 1
group by a.id
limit 10
SELECT
A.id,count(B.user_id) as cnt
FROM
user_cash B,user A
where
A.id= B.user_id and
B.flag='D'
group by B.id
having cnt > 1
-->