mysql - Displays value of those part of the selected parameter -


sorry bother again, have difficulties in formulating query . have 2 columns date values. (see sample below)

posting date                col b feb 02,2013              feb 01, 2013 feb 02, 2013             feb 15, 2013 mar 03,2013              mar 01, 2013 april 12, 2013           april 12, 2013  

if parameter range of date based on col b (ex. colb between 02/01/2013 , 02/28/2013). want show value in posting date part of date range had filtered. say, having month of feb , 2013 year

results:

posting date                col b feb 02,2013              feb 01, 2013 feb 02, 2013             feb 15, 2013 

is you're looking for? field type of posting_date column date? if so, should work:

select posting_date, colb yourtable posting_date >= '2013-02-01'    , posting_date < '2013-03-01' 

i prefer using >= , < rather between.

if posting_date field stored varchar, use str_to_date:

select posting_date, colb yourtable str_to_date(posting_date , '%m %d,%y') >= '2013-02-01'    , str_to_date(posting_date , '%m %d,%y') < '2013-03-01' 

sql fiddle demo


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -