I need just only data by pbox.id<'".$pbid."' and cbox.id<'".$cbid."'
but it does not work. I tried a lot of things still not work, it gets all data. It not look my less than operators. How I solve this issue?
SELECT DISTINCT pbox.id as pbid,
cbox.id as cbid,
box.upload_type,
box.id,
box.box_type,
box.page_name,
box.title,
box.connect,
box.type,
box.uid,
box.description,
box.image,
box.url,
box.status,
box.date,
box.time
FROM boxes as box
LEFT JOIN page_boxes as pbox on pbox.bid=box.id
JOIN page_subcribers as pages on pages.page_id=pbox.page_id
LEFT JOIN category_boxes as cbox on cbox.bid=box.id
LEFT JOIN subcribers as catsb on cbox.category_id=catsb.cid
WHERE pages.uid='".$session_id."' or catsb.uid='".$session_id."' and box.status='".$approval."' and cbox.id<'".$cbid."' and pbox.id<'".$pbid."'
ORDER BY pbox.id desc,cbox.id DESC LIMIT 10
Try forcing the operator precedence using brackets on the WHERE clause:-
SELECT DISTINCT pbox.id as pbid,
cbox.id as cbid,
box.upload_type,
box.id,
box.box_type,
box.page_name,
box.title,
box.connect,
box.type,
box.uid,
box.description,
box.image,
box.url,
box.status,
box.date,
box.time
FROM boxes as box
LEFT JOIN page_boxes as pbox on pbox.bid=box.id
JOIN page_subcribers as pages on pages.page_id=pbox.page_id
LEFT JOIN category_boxes as cbox on cbox.bid=box.id
LEFT JOIN subcribers as catsb on cbox.category_id=catsb.cid
WHERE (pages.uid='".$session_id."'
or catsb.uid='".$session_id."')
and box.status='".$approval."'
and cbox.id<'".$cbid."'
and pbox.id<'".$pbid."'
ORDER BY pbox.id desc,cbox.id DESC
LIMIT 10
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.