开发者

Pseudo codestructure to Mysql?

开发者 https://www.devze.com 2022-12-17 04:59 出处:网络
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)开发者_StackOverflow中文版 so that\'s not

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)开发者_StackOverflow中文版 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


I currently generate the right if/then/else part of the mysql query in php. If someone can answer the question properly, please do!

0

精彩评论

暂无评论...
验证码 换一张
取 消