Sql动态查询语法错误 [英] Sql dynamic query syntax error

查看:57
本文介绍了Sql动态查询语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的sql查询

"select * from applicant where email =ABC.Com"

我想要表名、列名和值在 where 子句之后以变量的形式动态显示.你能告诉我正确的语法吗?到目前为止我已经尝试过这个

I want table name, colum name and value after where clause dynamic in form of variables there. Can you tell me the right syntax? I have tried this so far

"select * from " tableNameVariable+"where "columnNameVariable+"= "inputedEmailVariable 

现在此查询在 =inputedEmailVariable 附近给出错误.注意:我想在 nodejs 函数中使用这个字符串.请告诉我正确的语法?

now this query is giving an error near =inputedEmailVariable. Note : I want to use this string in nodejs function. Please tell me right syntax?

推荐答案

尝试:

"select * from " + tableNameVariable + " where " + columnNameVariable + " = '" + inputedEmailVariable + "'"

这篇关于Sql动态查询语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆