Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +------+--------+--------+---------------------+
- | Type | Value1 | Value2 | DateAdded |
- +------+--------+--------+---------------------+
- | 1 | a | a | 2014-03-31 20:00:00 |
- | 2 | a | a | 2014-03-31 20:00:10 |
- | 3 | a | a | 2014-03-31 20:00:25 |
- | 1 | a | a | 2014-03-31 20:00:40 |
- | 2 | a | a | 2014-03-31 20:00:50 |
- | 3 | a | a | 2014-03-31 20:00:60 |
- | 1 | a | a | 2014-03-31 20:01:10 |
- | 2 | a | a | 2014-03-31 20:01:25 |
- | 3 | a | a | 2014-03-31 20:01:35 |
- +------+--------+--------+---------------------+
- select *
- from table t
- where 20 >= (select count(*)
- from table t2
- where t2.type = t.type and
- t2.DateAdded >= t.DateAdded
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement