TSQL:为什么不运行?

时间:2016-01-25 19:56:18

标签: sql-server tsql

鉴于此T-SQL代码:

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

flex-fixed, sections, section, div, pages, page {
  display: flex;
}

body {
  height: 100vh;
}

flex-fixed {
  width: 100%;
  height: 100%;
  flex-direction: column; 
  position: fixed;
}

section {
  border-right: 1px solid lightgrey;
}

splitter {
  height: 1px;
  background: lightgrey;
}

pages {
  height: 100%;
  border-left: 1px solid lightgrey;
  align-self:flex-end; 
  flex-direction: column;
}

page {
  border-bottom: 1px solid lightgrey;
}

section, page, div {
  padding: 10px;
}

SQL Server返回此错误:

  

第15行,第15行,第1行,第22行   关键字' WHERE'附近的语法不正确。

内部加入&#34; SELECT Tbl_RecibosCobroComisionesDetalle.MontoComision, Tbl_Recibos.IdRecibo, Tbl_RecibosCobros.IdCobro FROM Tbl_RecibosCobroComisionesDetalle INNER JOIN Tbl_RecibosCobroComisiones ON Tbl_RecibosCobroComisionesDetalle.IdCobroComision = Tbl_RecibosCobroComisiones.IdCobroComision INNER JOIN Tbl_Recibos INNER JOIN Tbl_Polizas ON Tbl_Polizas.IdPoliza = Tbl_Recibos.IdPoliza INNER JOIN Tbl_Ramos ON Tbl_Polizas.IdRamo = Tbl_Ramos.IdRamo INNER JOIN Tbl_Empresas ON Tbl_Recibos.IdEmpresa = Tbl_Empresas.IdEmpresa INNER JOIN Tbl_RecibosCobrosDetalle ON Tbl_Recibos.IdRecibo = Tbl_RecibosCobrosDetalle.IdRecibo INNER JOIN Tbl_RecibosCobros ON Tbl_RecibosCobrosDetalle.IdCobro = Tbl_RecibosCobros.IdCobro INNER JOIN Tbl_CompaniasSeguro ON Tbl_CompaniasSeguro.IdCompania = Tbl_Polizas.IdCompania WHERE (Tbl_Recibos.IdEstatus = 6) AND Tbl_Empresas.IdEmpresa = @IdEmpresa AND Tbl_Recibos.FechaCancelado >= @fDE AND Tbl_Recibos.FechaCancelado <= @fHasta AND Tbl_RecibosCobros.IdEstatus = 1 AND Tbl_Recibos.Comision < 0 &#34;

说:&#34; Tbl_CompaniasSeguro ON Tbl_CompaniasSeguro.IdCompania = Tbl_Polizas.IdCompania&#34;

为什么?

1 个答案:

答案 0 :(得分:2)

您在本节中遗漏了ON

INNER JOIN     
    Tbl_RecibosCobroComisiones.IdCobroComision ON Tbl_RecibosCobroComisionesDetalle.IdCobroComision = Tbl_RecibosCobroComisiones.IdCobroComision  
INNER JOIN 
    Tbl_Recibos 
INNER JOIN 
   ......