我想基于存储过程输入构建自定义Where条件,如果不是null,那么我将在语句中使用它们,否则我将不使用它们.
if @Vendor_Name is not null
begin
set @where += 'Upper(vendors.VENDOR_NAME) LIKE "%"+ UPPER(@Vendor_Name) +"%"'
end
else if @Entity is not null
begin
set @where += 'AND headers.ORG_ID = @Entity'
end
select * from table_name where @where
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个错误
An expression of non-boolean type specified in a context where a condition is expected, near 'set'.
Run Code Online (Sandbox Code Playgroud) 如果我有这个架构:
Doctor(license_no, doctor_name, specialty)
Patient(pat_id, pat_name, pat_address, pat_phone, date_of_birth)
Visit(license_no, pat_id, date, type, diagnosis, charge)
Run Code Online (Sandbox Code Playgroud)
而且我想获得Davy Jones博士获得的金额,以下查询在逻辑上是正确的吗?NB它在SQL中运行
SELECT SUM(charge)
FROM Visit v INNER JOIN Doctor d
ON (d.licence_no = v.licence_no AND doctor_name = 'davy jones')
Run Code Online (Sandbox Code Playgroud) 我有一个简单的 makefile,它应该打印 Git 日志,如下所示。
SHELL=/bin/bash
get_log:
echo $(git log)
Run Code Online (Sandbox Code Playgroud)
但是,当我运行时,make get_log没有任何返回。虽然如果我git log直接在 CMD 中运行,我会得到结果。
这里可能有什么问题?
注意:make文件格式正确;我在这里使用空格而不是制表符来发布问题。
我有一个网站的登录页面,成员在文本框中插入他们的电子邮件.我的问题是如何根据文本框的值重定向到另一个页面,例如
Response.Redirect("homepage.aspx?and here the value of the textbox");
Run Code Online (Sandbox Code Playgroud) sql-server ×2
asp.net ×1
bash ×1
c# ×1
dynamic-sql ×1
git ×1
linux ×1
makefile ×1
mysql ×1
shell ×1
sql ×1
where-clause ×1