If else satatement in MySQL functions and procedures

156
Views
1
Answers

How to use if else statements in MySQL functions or queries or stored procedure?

edit | flag
Mad Maddy
Asked on: Jan 24, 2012 at 11:25PM

1 Answers

103
2
103

The if else can be handled by

If(condition,return value if condition is satisfied, return value if condition is not satisfied)

For example

select if((year(2012)=year(CURDATE())),True,False) as date;

This query will return TRUE as the condition is satisfied.

edit | flag
Gokul A
Answered on: Jan 24, 2012 at 11:31PM

Post your Answer

Search

Welcome to Ask Amoeba!
This is 100% free and interactive site for sharing professional Questions and Answers, Opensource projects, Interview questions.
Learners, beginners, Experts stop and share your knowledge and ideas!

Browse Categories

Browse Tags