sql - 使用 LIKE 在查询中使用变量 grafana
问题描述
我正在尝试使用工具的内部变量在GRAFANA中使用 LIKE 创建一个查询,但它会通知变量的值,''
这会在 postgres 中的查询中产生错误,有什么建议吗?
询问:
select count(*) from table_name where column_name like ('%'$VARIABLE'%') LIMIT 1
输出:
pq: syntax error at or near "'VALUE_VARIABLE'"
解决方案
这个怎么样:
select count(*) from table_name where column_name like concat ('%', $VARIABLE, '%') LIMIT 1
推荐阅读
- bash - 如何自定义我的 bash 脚本代码?
- r - 带有 data.table 的子集,不理会 NA
- java - 使用 java 11 编译后的堆外泄漏
- excel - 具有连接值的 Excel sumif 或 sumifs
- javascript - 如何在不登录的情况下从 firebase 获取用户数据?
- reactjs - 在 React 中单击按钮时如何停止计时器?
- r - 如何在分组条形图中对条形进行排序?
- python - Python数据框子集
- javascript - Vue/Vuex 中的 Websockets(如何从服务器接收发射)
- html - Django:为什么我放置在 Django Summernote 中的文本会在我的 HTML 模板中显示 HTML 标记?