I have data like this
id | bookDate | regisDate | payDate | status
1 | 2001-12-31 | 2002-12-31 | 2003-12-31 | 1
2 | 2001-12-31 | 2002-12-31 | 2003-12-31 | 2
3 | 2001-12-31 | 2002-12-31 | 2003-12-31 | 3
and i want the result is like this
id | date | status
x | x | x
notice date field is reduced from 3 into 1 field. and the conditional is like this. if the status is 1 then take date from bookDate, if 2 take from regisDate, if 3 take from payDate
example for data with id 1, then the result of query will be like this
id | date | status
1 | 2001-12-31 | 1
it is possible do that in MySQL query?
You have
casestatements in MySQL.