Advertisement
Guest User

Untitled

a guest
May 5th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. Recid (key) | ID | Date | Value
  2. 1 | 1 | 02.02.11 | 7
  3. 2 | 1 | 02.03.12 | 8
  4. 3 | 1 | 02.04.13 | 0
  5. 4 | 1 | 02.05.14 | 2
  6. 5 | 2 | 02.01.12 | 8
  7. 6 | 2 | 02.02.13 | 0
  8. 7 | 3 | 02.02.13 | 2
  9. 8 | 3 | 02.03.14 | 2
  10. 9 | 3 | 02.05.14 | 0
  11.  
  12. SELECT COUNT(*) FROM table t WHERE t.Date = "03.05.13" AND t.Value>0 GROUP BY t.ID
  13.  
  14. 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