我有一个表test
,如下所示
Contract date_prolog hours
-------------------------------
No 20
Yes 24/02/2014 10
No 30
No 10
如何获得此结果?
Contract date_prolog hours
-------------------------------
No 24/02/2014 20
No 24/02/2014 30
No 24/02/2014 10
答案 0 :(得分:1)
select contract,
(select date_prolog from test where contract = 'yes') as date_prolog,
hours
from test
where contract = 'no'