Reputation: 25
This is my table in a mysql database:
number_used allocation_date deallocation_date
1 1-4-2013 00:00:00 5-4-2013 00:00:00
2 6-4-2013 00:00:00 10-4-2013 00:00:00
3 11-4-2013 00:00:00 15-4-2013 00:00:00
1 16-4-2013 00:00:00 20-4-2013 00:00:00
There are three columns with no unique values. 1 number is used between date 1-4-2013
to 5-4-2013
and other likewise.
How can I find out the number_used between dates 2-4-2013
to 14-4-2013
.
Upvotes: 0
Views: 93
Reputation: 172378
You can simple do this:-
SELECT number_used
FROM table_name
WHERE '14-4-2013' >= `allocation_date ` AND `deallocation_date` >= '2-4-2013'
Upvotes: 0
Reputation: 553
SELECT number_used from thetable WHERE allocation_date BETWEEN '2013-04-01' AND '2013-04-05';
Upvotes: 1