【发布时间】:2016-02-07 15:51:20
【问题描述】:
谁能给点灯:
逗号附近出现错误:
;with cteClaims as (
select a.LoanId, a.ID, a.ClaimType, a.ClaimStatus, a.ClaimTypeDescription
FROM [spd].[claims].[Population] a
group by a.LoanId, a.ID, a.ClaimType, a.ClaimStatus, a.ClaimTypeDescription
having a.ClaimStatus not in ('Closed', 'Denied', 'Paid')
), ctePopulation as (
select a.LoanId, a.ID, a.ClaimType, a.ClaimStatus, a.ClaimTypeDescription
FROM [spd].[claims].[Population] a
join cteClaims b on a.LoanId = b.LoanId
group by a.LoanId, a.ID, a.ClaimType, a.ClaimStatus, a.ClaimTypeDescription)
select loanid as cteLoanId
from [spd].[claims].[Population] where id in (select id from ctePopulation)
/// Error is here near this comma below
, cteLoanBase as (
select
a.LoanId as [Loan#]
, a.AcquisitionDt as [AcquisitionDt]
, a.CorpRecoverableBalanceAmt as [CorpRecoverableBalanceAmt]
, a.EscrowBalance as [EscrowBalance]
, a.FirstPaymentDueDt as [FirstPaymentDueDt]
, a.InvestorLoanId as [InvestorLoanId]
, a.InvestorPoolId as [InvestorPoolId]
, a.LoanStatusId as [LoanStatusId]
【问题讨论】:
-
这和C#有什么关系?你只发布了 SQL,对吧?
-
这适用于哪个 RDBMS?请添加标签以指定您使用的是
mysql、postgresql、sql-server、oracle还是db2- 或者完全是其他东西。
标签: c# sql syntax common-table-expression