mysql - How to substitute the values while Fetching itself -


i have table shown

 create table `document` (   `t1` varchar(50) default null,   `t2` varchar(50) default null,   `t3` varchar(50) default null,   `t4` varchar(50) default null,   `t5` varchar(50) default null,    status int default 0  );  insert document (t1 , status ) values ('pocorn',0); insert document (t1 , t2  , status ) values ('pocorn', 'bucket' , 1); insert document (t1 , t2 , t3 , status) values ('pocorn', 'chocka' , 'small' , 2); 

this sqlfiddle http://sqlfiddle.com/#!2/d816e/2

my question have 3 status

0 indiccates pending

1 indicates approved

2 indicates declined

is possible substitute values pending , approved , declined while fetching

select t1, t2, t3, t4,  case    when status=0 'pendig'   when status=1 'approved'   when status=2 'declined'   end   document 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -