Boolean parameter in Advanced query

Dear all,

Maybe it is already late but i have really troubles to figure out how to use a boolean query in a advanced query
the idea

SELECT {parts}.ID, {parts}.Name, {stock}.Quantity
FROM {Parts} left join {Stock} ON {parts}.ID = {Stock}.Part_ID

this works but i want to add a boolean which can help me to filter parts which arent listed on the stock table

SELECT {parts}.ID, {parts}.Name, {stock}.Quantity
FROM {Parts} left join {Stock} ON {parts}.ID = {Stock}.Part_ID

IF(@bool,WHERE ....., nothing)

is it possible to enable the where statement in case the bool is true?


Don't know if it is the best way, but I added a boolean value to the output this way:

The last value is the boolean. In the first part, I set it to false (0). The secord part of the query sets it to true (1)

Hope this helps.