영카트 가격 조회

영카트 가격 조회

QA

영카트 가격 조회

본문

영카트 목록에서 검색창을 구현중인데요 만원 이하랑 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 it_name, ca_id, it_rental_price from g5_shop_item
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

이렇게 보시고
필요한 조건은 추가해 보세요

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

현재 쿼리가.. 브랜드를 선택 후에 렌탈가격을 만원 이하를 클릭 했는데요..
쿼리가 맞는지 좀.. 그리고 렌탈가격 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로 해야된다해서 이렇게 했는데 불필요한것도 조회가 되어서요 ㅠ

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매직','로디',

..., '휴롬')

이렇게 하는 것이 좋을 듯 합니다

 

엑스엠엘님 혹시 가격때별 조회 좀 알수있나요
이렇게 쿼리를 했는데
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만원부터 상품이 나오질 않네요

답변을 작성하시기 전에 로그인 해주세요.
전체 203
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT