Advertisement
relax4o

sql-categories-news

Jul 13th, 2013
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.31 KB | None | 0 0
  1. SELECT news.*
  2. FROM news, cats
  3. WHERE (news.cat_id = cats.cat_id AND
  4.         (
  5.             ((SELECT cats.cat_id FROM cats WHERE cats.cat_id = 1) = cats.cat_id) OR
  6.             ((SELECT cats.subcat_to FROM cats WHERE cats.cat_id = 1) = cats.cat_id) OR
  7.             ((SELECT cats.subsubcat_to FROM cats WHERE cats.cat_id = 1) = cats.cat_id)
  8.         )
  9.     )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement