我想根据col值选择col:
$query = SELECT col1,col3,col4 if col5>1 , SELECT col2,col3 if col5<1
FROM table1 WHERE id='745';
怎么做?
答案 0 :(得分:0)
不完全确定这是否是您想要的,但它对我有用:
SELECT IF(col5 < 1, col1, col2), col3, IF(col5 < 1, col4,"")
FROM table1 where id = '745';