mysql - using BETWEEN operator twice in one SQL statement -


this have tried, did not work.

select count(*) month_count `wp_postmeta`      `meta_key`='from_dt' ,       (`meta_value` between '$st' , '$end') ,       (`meta_value` between '$st1' , '$end1'); 

i'm trying count number of months come between epoch time of $st , $end of year & between $st1 , $end1 of next year. have 2 dates (feb 2013 , feb 2014)in meta_value fields, want query return 2(as there 2 february's).

how use 2 between operators in 1 sql statement?

nothing technically wrong query, depending on desired results, want using or -- make sure parentheses in correct place:

select count(*) month_count `wp_postmeta`      `meta_key`='from_dt' ,       ((`meta_value` between '$st' , '$end') or       (`meta_value` between '$st1' , '$end1')) 

your current query requiring meta_value between both sets of numbers may problem.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -