영카트 가격 조회
본문
영카트 목록에서 검색창을 구현중인데요 만원 이하랑 1만원때, 2만원 3만원 10만원 이상까지 있는데요
이게 필드가 판매가 필드가 아니라 제가 만든 필드인데 자꾸 전부다.. 나와서요
아래쿼리 뭐가 잘못된건가요
select * from g5_shop_item where it_use = '1' and ca_id like '%30%' and (it_brand like '%드롱기%') or (it_brand like '%SK매직%') and ( it_rental_price between 10000 and 20000 ) or (it_rental_price between 20000 and 30000 ) or (it_rental_price between 30000 and 40000 ) order by it_update_time desc limit 0, 20
답변 4
select * from g5_shop_item where it_use = '1' and ca_id like '30%'
and (
(it_brand like '%드롱기%') or (it_brand like '%SK매직%') or (it_brand like '%로디%') or (it_brand like '%샤오미%') or (it_brand like '%크루거%') or (it_brand like '%바스티안%') or (it_brand like '%엔뚜마노%') or (it_brand like '%미락%') or (it_brand like '%휴롬%')
) and
/* 여기부터는 원하시는 게 뭔지 짐작이 안 가네요*/
(
( it_rental_price <= 10000)
or ( it_rental_price between 0 and 10000 ) or ( it_rental_price between 0 and 20000 ) or (it_rental_price between 0 and 30000 ) or (it_rental_price between 0 and 50000 )
)
order by it_update_time desc , it_order, it_id desc
or를 쓰시면 그렇게 됩니다
select * from g5_shop_item
where it_use = '1'
and ca_id like '30%'
and (
it_brand like '%드롱기%'
or it_brand like '%SK매직%'
or (it_brand like '%로디%') or (it_brand like '%샤오미%') or (it_brand like '%크루거%') or (it_brand like '%바스티안%') or (it_brand like '%엔뚜마노%') or (it_brand like '%미락%') or (it_brand like '%휴롬%')
) and ( it_rental_price <= 10000)
order by it_update_time desc , it_order, it_id desc limit 20, 20
이런 식입니다.
it_brand 를 왜 like 로 하셨나 모르겠군요
it_brand in ( '드롱기','SK매직','로디',
..., '휴롬')
이렇게 하는 것이 좋을 듯 합니다