我正在尝试创建一个查询来比较 where 子句中数据库名称的长度。 例如,如果数据库名为“test1”,则查询必须返回 ID 为“1234”的所有用户,但不起作用。
有人知道怎么做吗?这是查询:
select * from users where id='1234’ AND 5=(select length(database()))
最佳答案
这很完美:
select * from users where id='1234' AND 10=(select length(database()));
查看此 this Fiddle .数据库名称是 db_2_b7100
。
关于mysql - where 子句中的数据库名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20456440/