마

db를 불러올때말이지요..

<?
    $qry = "SELECT op_pcode,sum(op_cnt) as cnt
            FROM view_order where paystatus = 'Y'
            and canceled = 'N'
            and ifnull(isNow,'N') = 'Y'
            group by op_pcode
            order by cnt desc limit 10";
 

    $rlt = mysql_query($qry);
    while($row = mysql_fetch_array($rlt)) {
        $pcode = $row['op_pcode']; 
        $pcnt = $row['cnt']; 
        //상품명
        $prslt =  mysql_fetch_array(mysql_query("select name,cateCode,price_org,price,saleCnt from odtProduct where code='".$pcode."'"));
        $pname = $prslt[name];
        $price_org = $prslt[price_org];
        $price = $prslt[price];
        $pcatecode = $prslt[cateCode];
  $psalecnt = $prslt[saleCnt];
        //카레고리명
        $pcatename =  mysql_result(mysql_query("select catename from odtCategory where catecode='".$pcatecode."'"),0);
?>
 
 
이것들이 다 무슨 말이지요?? 저는 디비 안에 있는   [saleCnt] 라는 디비값만 가져오고 싶은데...
 
저 위의 구문이 해석이 안되니 힘드네요 ..
 
빨간색 구문은 특히 이해가 안갑니다 무슨 설정 값인지..
 
아래부분은 대충 이해는 했습니다만 ㅠㅠ
 
 
해석해주실 능력자분 계신가요?
|

댓글 3개

자유게시판에서 게시물 이동됩니다.
SELECT 검색해라
op_pcode,sum(op_cnt) as cnt 를
FROM view_order 이테이블에서
where paystatus = 'Y'
            and canceled = 'N'
            and ifnull(isNow,'N') = 'Y'
조건은 지불상태가y이면서 취소하지 않은것을 그리고 isnow 상태가 비어있다면 n으로 바꿔라 그 isnow 가 y 인조건으로

            group by op_pcode
그결과를 op_pcode 로 묵어라

order by cnt desc
소팅하라 cnt가 높은순으로
limit 10
그중 10개만 출력하라 정도 되겠습니다
정말 감사합니다!!! 많은 도움이 되었어요!! ㅠㅠ
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
16-03-02 조회 3,237
16-01-19 조회 2,519
15-12-23 조회 2,902
15-12-08 조회 3,657
14-10-30 조회 5,711
14-06-06 조회 5,545
12-08-30 조회 3,894
12-08-20 조회 3,819
12-07-15 조회 5,153
12-07-13 조회 3,626
12-07-06 조회 3,848
12-06-27 조회 3,364
12-06-23 조회 3,561
12-05-03 조회 5,177
12-04-20 조회 4,118
12-03-29 조회 4,618
12-03-22 조회 4,701
12-03-22 조회 3,506
12-03-21 조회 3,275
12-03-11 조회 3,706
12-03-06 조회 4,257
12-02-22 조회 4,526
12-02-17 조회 3,323
12-02-17 조회 6,171
12-02-14 조회 6,120
12-02-06 조회 4,254
12-01-18 조회 3,209
12-01-06 조회 3,437
11-12-30 조회 3,899
11-12-30 조회 7,050
11-12-21 조회 3,265
11-12-21 조회 4,240
11-12-16 조회 3,267
11-12-15 조회 3,314
11-12-15 조회 3,414
11-12-15 조회 4,218
11-12-09 조회 3,222
11-12-09 조회 3,300
11-12-07 조회 2,868
11-12-07 조회 3,956
11-12-05 조회 4,407
11-12-02 조회 3,858
11-12-01 조회 2,724
11-12-01 조회 2,767
11-12-01 조회 2,751