This is what I have tried, but did not work.
SELECT COUNT(*) AS month_count
FROM `wp_postmeta`
WHERE
`meta_key`='from_dt' AND
(`meta_value` BETWEEN '$st' AND '$end') AND
(`meta_value` BETWEEN '$st1' AND '$end1');
I'm trying to count the number of months which come between epoch time of $st and $end of this year & between $st1 and $end1 of next year. Say I have 2 dates (feb 2013 and feb 2014)in meta_value fields, I want the query to return 2(as there are 2 February's).
How to use 2 between operators in one sql statement?
meta_valuecannot be two different values at the same time, do you meanOR?