无法绑定多部分标识符“itemDetail.BillDate”

时间:2014-09-16 11:08:28

标签: sql-server-2008-r2

SELECT DISTINCT  [Billlist].[billno] [Bill No.],temp.[BillDate] [Date],[Billlist].[user] [Customer Name],[Billlist].[total] Total,[paid] Paid,[discount] Discount 
           FROM temp  
           JOIN [Billlist]  ON temp.[billno]=[Billlist].[billno] 
          WHERE itemDetail.[BillDate]  BETWEEN '9/19/2014' and '9/19/2014'  

我该怎么办?

我需要过滤,但如果我使用我有错误!

任何人都要尽快回复我。

1 个答案:

答案 0 :(得分:0)

除非itemDetail.[BillDate]在where子句中确实应该是temp.[BillDate],否则您需要将itemdetail表与相应的表一起加入。

根据列名称,我猜测您的查询应如下所示:

SELECT DISTINCT  
    [Billlist].[billno] [Bill No.],
    temp.[BillDate] [Date],
    [Billlist].[user] [Customer Name],
    [Billlist].[total] Total,
    [paid] Paid,
    [discount] Discount 
FROM temp  
JOIN [Billlist] ON temp.[billno] = [Billlist].[billno] 
WHERE temp.[BillDate] BETWEEN '9/19/2014' and '9/19/2014'