我目前正在尝试将一些Oracle SQL转换为MySQL,并在Oracle中遇到WITH
关键字。 MySQL中是否有等效的WITH
?感谢
WITH
示例:
with cus as (select id from tb_company where id=3)
select * from cus;
答案 0 :(得分:1)
是的,自MySQL版本8.0以来有一个等价物:
var balance = 325.00;
var checkBalance = true;
var isActive = false;
//The first question
if (checkBalance) {
// the second question
if(isActive) {
handleIsActive(balance);
} else {
console.log("Your account is no longer active.");
}
} else {
console.log("Thank you. Have a nice day");
}
function handleIsActive(balance) {
if(balance > 0) {
console.log("Your balance is " + balance.tofix(2) +"$.");
} else if(balance === 0) {
console.log("Your Accunt is empty");
} else {
console.log("Your balance is negetive, please contant bank");
}
return;
}