Guest User

Untitled

a guest
Jul 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. SELECT c.*, count(a.post_id) as item_count
  2. FROM tbl_category c
  3. LEFT JOIN tbl_postad a on a.post_maincategory = c.cat_id
  4. WHERE c.cat_parent=0 AND c.cat_promote = 0
  5. AND c.selActive = 'Y' AND a.post_delete_status!='Y' AND a.post_cat_status!='N'
  6. AND a.post_status='Y' AND a.block=0 AND a.post_expiredate >= '".date("Y-m-d H:i:s")."'
  7. GROUP BY c.cat_name
  8. ORDER BY c.cat_sort asc
  9.  
  10. SELECT c.*, count(a.post_id) as item_count
  11. FROM tbl_category c
  12. LEFT JOIN tbl_postad a on a.post_maincategory=c.cat_id
  13. WHERE c.cat_parent=0 AND c.cat_promote = 0 AND c.selActive = 'Y'
  14. GROUP BY c.cat_name
  15. ORDER BY c.cat_sort asc
  16.  
  17. select c.*, count(a.post_id) as item_count
  18. from tbl_category c left join
  19. tbl_postad a
  20. on a.post_maincategory = c.cat_id and
  21. a.post_delete_status <> 'Y' and
  22. a.post_status = 'Y' and
  23. a.post_cat_status <> 'N' and
  24. a.block = 0 and
  25. a.post_expiredate >= '".date("Y-m-d H:i:s")."'
  26. where c.cat_parent = 0 and
  27. c.cat_promote = 0 and
  28. c.selActive = 'Y' ;
Add Comment
Please, Sign In to add comment