Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. Select *
  2. From (
  3. Select *, ROW_NUMBER() OVER (ORDER BY DateSend DESC) AS Num
  4. From News
  5. Where SubjectID in(Select MenuSubject.SubjectID
  6. From MenuSubject inner join Menu on MenuSubject.MenuID = Menu.MenuID)
  7. ) as myTable
  8. where myTable.Num BETWEEN 100 and 120
  9.  
  10. DECLARE @MyTable2 IntListTable
  11. Insert Into @MyTable2
  12. Select MenuSubject.SubjectID
  13. From MenuSubject inner join Menu on MenuSubject.MenuID = Menu.MenuID
  14. Select *
  15. From (
  16. Select *, ROW_NUMBER() OVER (ORDER BY DateSend DESC) AS Num
  17. From News
  18. Where SubjectID in @MyTable2
  19. ) as myTable
  20. where myTable.Num BETWEEN 100 and 120
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement