Advertisement
relax4o

Untitled

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