MySQL Forums
Forum List  »  General

Using SELECT within if clausure
Posted by: Rhett Butler
Date: December 21, 2019 02:29PM

Hey there!

What I simply need to use is a database query if some conditions accurates.

IF (TIMEDIFF("2017-06-25 13:10:11", "2017-06-15 13:10:10")) {
SELECT * FROM tb_test;
} ELSE {
SELECT `row_test` FROM tb_test;

Do I need to build a function for that?

MySQL V 8.0.17

Options: ReplyQuote

Written By
Using SELECT within if clausure
December 21, 2019 02:29PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.