不区分大小写的查询

时间:2018-02-07 12:25:36

标签: google-bigquery

我们也转而使用bigQuery,现在我正在我的桌面上设置并探索BigQuery 在我的数据库中。我有一个名为SearchAPI的表包含userId, userDisplayName, username

他们有`

[{"username":"bushra","userDisplayname":"Bushra Ahmed Shaswar","userId":"fsds"},

{"username":"Amigo_123","userDisplayname":"Amigo Bachora","userId":"Amigo"}]

然而,当我查询B资本时,它会给我上面的结果,但是如果它有一个小的b,它就不会返回任何内容。

这是我的疑问:

  var theQuery = '%' + req.query.name + '%';

  // The SQL query to run
  const sqlQuery = `
  SELECT
   username, userDisplayname,userId
  FROM
   WordsDatabase.SearchAPI
  WHERE
   userDisplayname Like '${theQuery}'`;

1 个答案:

答案 0 :(得分:2)

以下是BigQuery Standard SQL

    

选项1

 <div class="container">
  <div class="row">
    <div class="col-4">
      First, but unordered
    </div>
    <div class="col-4 order-sm-4">
      Second in sm+, last in mobile
    </div>
    <div class="col-4 order-3">
      Last in sm+, Second in mobile
    </div>
  </div>
</div>

选项2

var theQuery = '%' + req.query.name + '%';

// The SQL query to run
const sqlQuery = `
SELECT
 username, userDisplayname,userId
FROM
 WordsDatabase.SearchAPI
WHERE
 LOWER(userDisplayname) Like LOWER('${theQuery}')`;