【问题标题】:Convert rows to lowercase in node-postgres在 node-postgres 中将行转换为小写
【发布时间】:2015-08-24 23:37:03
【问题描述】:

我目前正在使用node-postgres 像这样查询我的数据库:

SELECT DISTINCT(name) FROM users.names ORDER BY name;

我想返回这些名称的小写,所以我尝试了这个:

SELECT DISTINCT(lower(name)) FROM users.names ORDER BY lower(name);

...但这只是返回 null 来代替每个名称。

【问题讨论】:

    标签: node.js postgresql node-postgres


    【解决方案1】:

    这解决了它:

    SELECT DISTINCT(LOWER(tag)) AS tag FROM support.tags ORDER BY LOWER(tag);
    

    加的key明显是AS tag,否则结果集中'tag'字段重命名为'lower'。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-21
      • 2021-12-03
      • 1970-01-01
      • 1970-01-01
      • 2018-08-17
      • 2013-06-30
      • 2021-11-15
      • 1970-01-01
      相关资源
      最近更新 更多