SQL Server - 语法错误

时间:2015-05-05 12:50:49

标签: sql sql-server database datetime where-clause

我一直得到:“关键字'WHERE'附近的语法错误不正确。

我正在寻找“最难”的时间。我已经消除了除此之外的所有语法错误,我感到很茫然。任何帮助,将不胜感激。 WHERE子句---我把**包围在**中**。需要额外的EYES!

public abstract class BaseEntityController<TModel, TDto, TService, TErrorEnum>
{ }

1 个答案:

答案 0 :(得分:1)

您需要在联接的末尾添加结束括号。

  

或locations.DateInvalidated IS NULL)

(locations.FeederSlot=placements.FeederSlot and
locations.FeederTrack = placements.FeederTrack and
locations.FeederStack = placements.FeederStack and
locations.FeederPallet = placements.FeederPallet and
locations.MachineName = placements.MachineName and
placements.PlacementTime >= locations.DateValidated and 
(placements.PlacementTime <= locations.DateInvalidated 
or locations.DateInvalidated IS NULL))