小编Moh*_*kim的帖子

在SQL语句中构建动态where条件

我想基于存储过程输入构建自定义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)

sql sql-server stored-procedures dynamic-sql where-clause

4
推荐指数
2
解决办法
2万
查看次数

关于查询的意见

如果我有这个架构:

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)

mysql sql-server

1
推荐指数
1
解决办法
52
查看次数

Git 命令未在 makefile 中返回任何值

我有一个简单的 makefile,它应该打印 Git 日志,如下所示。

SHELL=/bin/bash

get_log:
    echo $(git log)
Run Code Online (Sandbox Code Playgroud)

但是,当我运行时,make get_log没有任何返回。虽然如果我git log直接在 CMD 中运行,我会得到结果。

这里可能有什么问题?

注意:make文件格式正确;我在这里使用空格而不是制表符来发布问题。

linux git bash shell makefile

1
推荐指数
1
解决办法
263
查看次数

如何从文本框的值添加查询字符串?ASP .NET c#

我有一个网站的登录页面,成员在文本框中插入他们的电子邮件.我的问题是如何根据文本框的值重定向到另一个页面,例如

Response.Redirect("homepage.aspx?and here the value of the textbox");
Run Code Online (Sandbox Code Playgroud)

c# asp.net visual-studio

0
推荐指数
1
解决办法
3717
查看次数