A little idea of sql usage

Today, my colleague asked me a question. According to the sql parameters passed in, we need to determine which filter conditions to use. I thought it could be solved by using the <if></if> tags directly. Then I found that the old system no longer has documents. Without this if tag, there is only a non-empty <nnv></nnv> tag,

So how can we achieve the effect of if branching?

On a whim, select 1 as a from dual where ('param'='1' and 《Your Filter Condition 1》) or ('param'='2' and 《Your Filter Condition 2》)

Achieving the effect of the if branch

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326613205&siteId=291194637