mysql - SQL select where column clause -


i have table follows

date1   |  date2  | datechoice  1-5-17    2-6-17      date2 

datechoice can either date1 or date2. , want first @ datechoice column decide column use in statement.

example pseudo code:

case when datechoice ='date2' date2 >= 2-2-17 , date2 <= 2-9-17 else date1 >= 2-2-17 , date1 <= 2-9-17 

how can this?

where (datechoice ='date1' , date1 >= '2017-02-02' , date1 <= '2017-02-09')    or (datechoice ='date2' , date2 >= '2017-02-02' , date2 <= '2017-02-09')  

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -