Topic: SQL query for numerical values
Greetings to all. I have a button with SQL query. The problem is when to specify a search on a field with numbers.
WHERE
(
({Edit3} = '' OR PReg.PSum >= {Edit3}) AND
({Edit4} = '' OR PReg.PSum <= {Edit4})
)
constant error that the syntax is not valid for MySQL.
i tried
(
(IFNULL({Edit3}, '') = '' OR PReg.PSum >= IFNULL({Edit3}, 0))
AND
(IFNULL({Edit4}, '') = '' OR PReg.PSum <= IFNULL({Edit4}, 999999999999))
)
but the same thing.
Maybe someone has an example of a SQL query using a request for numeric (more and/or less), dates (more and/or less), checkboxes. Because when I don't have certain fields filled in on the search form, the request gives a constant error about incorrect syntax.
Or maybe it is better to do it through a script in the program to additionally control the conditions. But how is it correct to edit the selected record after filling the table?