영카트 가격 조회 채택완료
영카트 목록에서 검색창을 구현중인데요 만원 이하랑 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
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 3개
이렇게 쿼리를 했는데
select * from g5_shop_item where it_use = '1' and ca_id like '%20%' and it_price between '500000' and '873000' order by it_update_time desc limit 0, 20
5만원부터 상품이 나오질 않네요
댓글을 작성하려면 로그인이 필요합니다.
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 로 하셨나 모르겠군요
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 5개
where it_use = '1'
and ca_id like '30%'
and (it_rental_price between 30000 and 40000 )
order by it_update_time desc limit 0, 20
이렇게 보시고
필요한 조건은 추가해 보세요
현재 쿼리가.. 브랜드를 선택 후에 렌탈가격을 만원 이하를 클릭 했는데요..
쿼리가 맞는지 좀.. 그리고 렌탈가격 2개이상부터 and 필터로 했는데 문제가 되네요
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) and ( it_rental_price between 0 and 10000 ) and ( it_rental_price between 0 and 20000 ) and (it_rental_price between 0 and 30000 ) and (it_rental_price between 0 and 50000 ) order by it_update_time desc , it_order, it_id desc
이것도 올바르게 했는지 좀 ㅠㅠ 한번만 봐주실수있나요~ 자꾸 필요 없는 ca_id 50부터 조회되네요
지금 렌탈판매가 선택 항목이 1만원이하, 1만원이상 2만원이상 3만원 5만원 5~7만원, 8~10만원 10만원이상 이렇게 있거든요 브랜드는 or로 했을때 검색이 잘되는데 가격부터는 and로 해야된다해서 이렇게 했는데 불필요한것도 조회가 되어서요 ㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인