Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. +------+--------+--------+---------------------+
  2. | Type | Value1 | Value2 | DateAdded |
  3. +------+--------+--------+---------------------+
  4. | 1 | a | a | 2014-03-31 20:00:00 |
  5. | 2 | a | a | 2014-03-31 20:00:10 |
  6. | 3 | a | a | 2014-03-31 20:00:25 |
  7. | 1 | a | a | 2014-03-31 20:00:40 |
  8. | 2 | a | a | 2014-03-31 20:00:50 |
  9. | 3 | a | a | 2014-03-31 20:00:60 |
  10. | 1 | a | a | 2014-03-31 20:01:10 |
  11. | 2 | a | a | 2014-03-31 20:01:25 |
  12. | 3 | a | a | 2014-03-31 20:01:35 |
  13. +------+--------+--------+---------------------+
  14.  
  15. select *
  16. from table t
  17. where 20 >= (select count(*)
  18. from table t2
  19. where t2.type = t.type and
  20. t2.DateAdded >= t.DateAdded
  21. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement