Reputation: 3392
I have two tables:
1. Users
id last_check
1 2014-10-30 19:24:16
2. Stream
id date
1 2014-10-30 19:22:16
2 2014-10-30 19:23:16
3 2014-10-30 19:24:16
4 2014-10-30 19:25:16
5 2014-10-30 19:26:16
I would like a query to count stream where stream date > last_check date. In the example above count will be 4 and 5. Thanks!
Upvotes: 2
Views: 25
Reputation: 4870
Try
SELECT COUNT(*) FROM Stream WHERE date > (SELECT last_check FROM Users LIMIT 1)
Upvotes: 1