许多人在写SQL时都想用if,下面教你正确使用方法。 1、 先准备好待处理的数据,见下图所示。 2、 许多人使用时习惯在select语句中直接嵌入if条件,所示。 3、 在SELECT语句中,通常使用CASE来实现IF的功能,具体用法所示。 4、 随后即可得出if语句的执行结果 ...
Well, if you happen to be using Sql Server you can do that sort of thing in T-Sql. In Oracle, you can also accomplish the same thing using pl/sql. Either way i'd do it in a stored ...