operand should contain 1 column(s) subquery MySQL -
i have problem when make subquery
select r.request_id, ( (select e.reportsto, (select e1.firstname employees e1 e1.nik = e.reportsto) firstname, (select e1.nik employees e1 e1.nik=e.nik) attention, (select e1.firstname employees e1 e1.nik=e.nik) attentionname employees e e.reportsto ='cs-nik-2016-0150' , e.nik='cs-nik-2016-0160') ) request r r.request_id='cs-req-bdg-201604-10099'
operand should contain 1 column(s), why?
use join instead of subquery. subquery may returns more 1 row,so shows error. avoid error use limit each of select not best solution,as in case return 1st row.
select r.request_id, ( (select e.reportsto, (select e1.firstname employees e1 e1.nik = e.reportsto limit 1) firstname, e.nik attention, firstname attentionname employees e e.reportsto ='cs-nik-2016-0150' , e.nik='cs-nik-2016-0160') ) request r r.request_id='cs-req-bdg-201604-10099'
Comments
Post a Comment