[英]Nested quotations in postgres SQL query
I have the following (correct) SQL statement: 我有以下(正确)SQL语句:
SELECT * FROM businesses WHERE identification -> 'persons' @>
'[{"id_person":"1234567890"}]'
It works from pgAdmin and returns correct result. 它可以从pgAdmin运行,并返回正确的结果。 In order to move it to my nodeJS code, I have to define a string variable (put in between quotations), something like:
为了将其移至我的nodeJS代码,我必须定义一个字符串变量(放在引号之间),类似于:
var sql="...";
How should I do it, having in mind the nested quotations? 考虑到嵌套的报价,我应该怎么做?
Did it by concatenating strings: 通过串联字符串做到了:
var sql = "SELECT * FROM businesses WHERE identification -> 'persons' @> '"
+ '[{"id_person":"1234567890"}]'
+ "'";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.