Brian Moon wrote:
On 12/23/08 2:22 PM, Brian Aker wrote:
Does anyone use the CASE operator? I see it for an SP, but in a SQL
statement... seems like it we be bad practice (though I think the same
of IF/ELSE in statements).

As for CASE, I have never used it, but then again, I have not been working with stored procedures very long as MySQL has not had them all that long. I learned to largely live without them. I have recently done some SP work, but have not used CASE. But, I would probably use it if the problem fit. But, using it in just a normal SQL statement? I don't see the fit either.

We often use IF and COALESCE to conform changed data sets to older API's. I will also use them for creating temporary tables to later use in joins or unions. I do the latter a lot more than you would think to avoid pulling large data sets back into my application. The PHP api can be very bad about large data sets. So, I avoid using them in PHP when I can reduce them in the DBMS.

I'd like to support those in favour of keeping CASE. It has been extremely useful for me in the past for generating cross-tabular reports in SQL.

-jay

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to