我想用多个条件查询连接两个表
string sql = "Select l.*, c.FirstName_CompanyName from dbo.Loan l left join Customer c on l.CustId=c.CustId where LoanAccountNo > 0 ";
当我实现了上面的代码,但我发现我需要过滤贷款表通过批准和删除,但我似乎不能得到它的权利。
下面的代码是我尝试过但没有工作的代码
string sql = "Select l.*, c.FirstName_CompanyName from dbo.Loan WHERE Delete = 0 AND Approve = 1 l left join Customer c on l.CustId=c.CustId where LoanAccountNo > 0 ";
{"Incorrect syntax near the keyword 'Delete'."}
请使用下面的代码,代码中存在类型错误,您在贷款表和别名l之间添加了删除dna批准条件
string sql = "Select l.*, c.FirstName_CompanyName from dbo.Loan l WHERE l.Delete = 0 AND l.Approve = 1 left join Customer c on l.CustId=c.CustId where LoanAccountNo > 0 ";
删除保留字。 试着把它放在引号里