Popular Tags

How the following user reports how to perform the data?

53 3

For example, there are two tables:
User table user, with field user_id, create_time
Post the table post, with field post_id, user_id, post_time

I'm trying to count:
Before 2014 -06-15 00: 00:, and in 2014 -06-15 00: 00, and in 2014 -06-15 00: 00:,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 00..........

How do you count and have a convenient statistical tool.

1 Answers

95 3

C # linq



var users = user.Where(t => 


t.create_time <DateTime.Parser("2014-06-15 00:00:00") &&


!t.post.Any(p => p.post_time <DateTime.Parser("2014-06-15 00:00:00")) &&


t.post.Any(p => p.post_time <DateTime.Parser("2014-06-20 23:59:59") && p.post_time> DateTime.Parser("2014-06-15 00:00:00")) &&


t.post.Any(p => p.post_time> DateTime.Parser("2014-06-21 00:00:00"));



int count = users.Count();


int post_count = users.Sum(t => t.post.Count());





...