2026, 새로운 도약을 시작합니다.

조인 오류 질문 채택완료

orderinquiryview.php 입니다

Copy



$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
         SUM(ct_qty) as qty
     from {$g5['g5_shop_cart_table']}
     where it_id = '{$row['it_id']}'
       and od_id = '$od_id' ";
$sum = sql_fetch($sql);

// 배송비
switch ($row['ct_send_cost']) {
    case 1:
        $ct_send_cost = '착불';
        break;
    case 2:
        $ct_send_cost = '무료';
        break;
    default:
        $ct_send_cost = '선불';
        break;
}

// 조건부무료
if ($row['it_sc_type'] == 2) {
    $sendcost = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $od_id);

    if ($sendcost == 0)
        $ct_send_cost = '무료';
}

for ($k = 0; $opt = sql_fetch_array($res); $k++) {
    if ($opt['io_type'])
        $opt_price = $opt['io_price'];
    else
        $opt_price = $opt['ct_price'] + $opt['io_price'];

    $sell_price = $opt_price * $opt['ct_qty'];
    $point = $opt['ct_point'] * $opt['ct_qty'];

    if ($k == 0) {
        ?>
    

    
        
            
            
                

                
            
        

        

item 테이블의 여분 필드인 it_1_subj 를 가져오려고 하는데 

다른건 잘 가져오는데

이 여분필드만 못가져 옵니다 ㅠ

어떻게 수정을 해야될까요?

3718050134_1641175393.2519.png 버스정류장 skp가 들어가있어야합니다

답변 1개

채택된 답변
+20 포인트

item 테이블에 it_1_subj 라는 칼럼이 있고 안에 데이터가 있다고 가정하고 말씀드릴께요

Copy



$sql1 = " select a.it_id, a.it_name, a.ct_send_cost, a.it_sc_type, b.it_1_subj
             from {$g5['g5_shop_cart_table']} a,{$g5['g5_shop_item_table']} b
            where a.od_id = '$od_id'
            group by a.it_id
            order by a.ct_id ";

 

=>

 

 


$sql1 = " select a.it_id, a.it_name, a.ct_send_cost, a.it_sc_type, b.it_1_subj
             from {$g5['g5_shop_cart_table']} as a inner join {$g5['g5_shop_item_table']} as b
              on a.it_id = b.it_id
            where a.od_id = '$od_id'
            group by a.it_id
            order by a.ct_id ";

쿼리를 위처럼 고쳐보시기 바랍니다

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

잘됩니다 감사합니다 ㅠ

댓글을 작성하려면 로그인이 필요합니다.

이 게시판은 회원만 글쓰기가 가능합니다. 로그인해 주세요.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고