IF ,Select statement error

I have this SQL query
SELECT Allocation_State FROM allocation_state where ws_cur_mode={Root Container.Tabel1.AllocationSate_F} IF ({Root Container.Dropdown.selectedValue}>0)

i received below error

java.lang.Exception: Error running query:
SQLQuery(query=SELECT Allocation_State FROM allocation_state where ws_cur_mode=1 IF (1>0)
, database=)@0ms
On: Main Window.Root Container.AllocationState 2.text

What are you trying to achieve? IF isn’t a selector on it’s own (in most SQL dialects at least), it’s always used to get something back.

The standard way to check some condition in SQL is via the WHERE clause, which is already in your query. So you perhaps just need to do
WHERE ws_cur_mode=1 AND {Root Container.Dropdown.selectedValue}>0

But it all depends on what you want to get back from the query.

Thanks a lot Sanderd>>> I used where&AND and it’s working now