Is it possible to call a new query within a conditional statement in MyBatis?

22 Views Asked by At

For example, I would like to do the following:

For example, I would like to do the following:

select name
from t1
<if test="
select count(*) from person where year='2024' " // If it is 1, call another query by query call.
>
</if>

Of course, I know the example is completely wrong. I don't know grammar.

Is this possible?

Do you really have to do it with if? I think you could ask the question, “Can I use AND?” However, I am testing various versions of a DBMS, and

This DBMS manages different columns for each version, so I don't think it can be done with AND.

The next best option is to call the query twice, but I would like to process it as one query.

0

There are 0 best solutions below