Col1 Col2 Col3 ---- --------------------- ------ AAA 18.92 18.92 BBB 20.00 40.00 AAA 30.84 30.84 BBB 06.00 12.00 AAA 30.84 30.84 AAA 46.79 46.79 AAA 86.40 86.40
当Col1 = AAA时Col3等于Col2,当Col1 = BBB时Col3为Col2两倍Col2.有人可以指点我吗?
SELECT Col1,Col2,CASE WHEN Col1='AAA' THEN Col2 WHEN Col1='BBB' THEN Col2*2 ELSE NULL END AS Col3 FROM ...