Mysql 的伪代码结构?
有人可以帮助在 mysql 中获取以下伪代码吗? IF 语句中的结果选择全部返回相同的列(4)和多行(未知),因此这并不是我面临的真正问题。如何在 Mysql 中获得以下结构?
//parameters
@p1;
@p2;
@v1;
@v2;
//vars
@t1= 15000;
@t2 = 15000;
//calculated vars
@overlap1 = (@p1 + @v1) > @t1; //boolean
@overlap2 = (@p2 + @v2) > @t2; //boolean
@overlap = @overlap1 OR @overlap2; //boolean
If NOT @overlap Then //no overlap
CUSTOM SELECT QUERIES (UNION etc..)
ElseIf @overlap1 AND @overlap2 //both overlaps true
CUSTOM SELECT QUERIES (UNION etc..)
ElseIf @overlap1 //only @overlap1
CUSTOM SELECT QUERIES (UNION etc..)
Else //only @overlap2
CUSTOM SELECT QUERIES (UNION etc..)
End If
Can somebody help get the following pseudocode in mysql? The resulting selects in the IF statement all return the same columns (4) and multiple rows (unknown) so that's not really the problem i'm facing.. How can I get the following structure in Mysql?
//parameters
@p1;
@p2;
@v1;
@v2;
//vars
@t1= 15000;
@t2 = 15000;
//calculated vars
@overlap1 = (@p1 + @v1) > @t1; //boolean
@overlap2 = (@p2 + @v2) > @t2; //boolean
@overlap = @overlap1 OR @overlap2; //boolean
If NOT @overlap Then //no overlap
CUSTOM SELECT QUERIES (UNION etc..)
ElseIf @overlap1 AND @overlap2 //both overlaps true
CUSTOM SELECT QUERIES (UNION etc..)
ElseIf @overlap1 //only @overlap1
CUSTOM SELECT QUERIES (UNION etc..)
Else //only @overlap2
CUSTOM SELECT QUERIES (UNION etc..)
End If
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我目前在 php.ini 中生成 mysql 查询的正确 if/then/else 部分。如果有人能正确回答这个问题,请回答!
I currently generate the right if/then/else part of the mysql query in php. If someone can answer the question properly, please do!