我希望MySQL与此相当:
If ( (SELECT COUNT(*) FROM TestTable) > 5) Then
SELECT * FROM TestTable
ELSE
SELECT * FROM OtherTable
END IF
答案 0 :(得分:1)
http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#function_if
SELECT IF(1> 2,2,3);将给出3作为答案,因此
SELECT IF((SELECT COUNT(*)FROM TestTable)> 5,SELECT * FROM TestTable,SELECT * FROM OtherTable);
应该做的伎俩...
我之前发布的链接,因为您已将其评论为您需要的内容:D