Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Recid (key) | ID | Date | Value
- 1 | 1 | 02.02.11 | 7
- 2 | 1 | 02.03.12 | 8
- 3 | 1 | 02.04.13 | 0
- 4 | 1 | 02.05.14 | 2
- 5 | 2 | 02.01.12 | 8
- 6 | 2 | 02.02.13 | 0
- 7 | 3 | 02.02.13 | 2
- 8 | 3 | 02.03.14 | 2
- 9 | 3 | 02.05.14 | 0
- SELECT COUNT(*) FROM table t WHERE t.Date = "03.05.13" AND t.Value>0 GROUP BY t.ID
- select top 1 count(distinct id) from some_table where date <= @limit group by date order by date desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement