B4J Question MySQL experts, come !!

marcick

Well-Known Member
Licensed User
Longtime User
I know yhis is not the correct place, but I googled much without success ...

I need to find the minimum value between the maximum value in a column and a constant

In my mnd the sintax would be this but doesn't work

SELECT LEAST(SELECT MAX(columnname) FROM records, 100);

Any help ?
 

OliverA

Expert
Licensed User
Longtime User
The problem with the quoting character is in PhpMyAdmin
No. Quoting is one of those things that each SQL engine seems to have their own solution towards (even though there is a standard). MySQL uses regular single quotes to delineate a string literal. It can also use double quotes for that task. (see https://dev.mysql.com/doc/refman/8.0/en/string-literals.html ). By default, MySQL uses the single back ticks to escape "object names" (see https://dev.mysql.com/doc/refman/8.0/en/identifiers.html). Now if you enable ANSI_QUOTES, double quotes can be used for object names, but never single quotes.
As I'm typing:
MS Sql Server accepts square brackets too !
As to
never single quotes
SQLite:
If a keyword in single quotes (ex: 'key' or 'glob') is used in a context where an identifier is allowed but where a string literal is not allowed, then the token is understood to be an identifier instead of a string literal.
source: https://www.sqlite.org/lang_keywords.html

Once more: I'm typing to slow
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Be careful in PhpMyAdmin (I think in MySql too) you have to quote with 0096 at the beginning and at the end, not use 0180
 
Upvote 0
Top