Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2013
    Posts
    6

    Unanswered: The multi-part identifier "column name" could not be bound.

    Hi can anyone help with my problem..

    which the column name is the c.Documenttype

    here is my T-sql code..
    SELECT [Hourly]
    ,count(case when C.Documenttype=1 THEN '1' END) as EDI
    ,count(case when C.Documenttype=2 THEN '2' END) as SI
    ,count(case when C.Documenttype=1 THEN '1' END) + count(case when C.Documenttype=2 THEN '2' END) as GrandTotal
    FROM
    (SELECT
    dateadd(hour, datediff(hour,CONVERT(VARCHAR(10),B.CreateDate,111 ) ,B.CreateDate)
    ,CONVERT(VARCHAR(10),B.CreateDate,111)) as [Hourly]
    from bookinglinkupdateinformation A
    left outer join bookinglinkinformation B
    on A.Barcode = B.Barcode
    left outer join bookinginformation C
    on B.HID = C.ID
    left join priority E
    on B.Urgent = E.ID
    where B.CreateDate between '2013-01-01 00:00:00' and '2013-01-02 23:59:59'
    and (A.Stage=0)
    and (C.Flag not between '2' and '3')
    ) idat


    thanks in advance..

  2. #2
    Join Date
    Apr 2012
    Posts
    213
    Hi,

    Try:

    Code:
    SELECT 
        [Hourly],
        count(case when Documenttype = 1 THEN '1' END) as EDI,
        count(case when Documenttype = 2 THEN '2' END) as SI,
        count(case when Documenttype = 1 THEN '1' END) + 
        count(case when Documenttype = 2 THEN '2' END) as GrandTotal 
    FROM 
        (SELECT 
             -- dateadd(hour, datediff(hour,CONVERT(VARCHAR(10),B.CreateDate,111 ) ,B.CreateDate),
             CONVERT(VARCHAR(10),B.CreateDate,111)) as [Hourly],
             C.Documenttype
         from bookinglinkupdateinformation A
         left outer join bookinglinkinformation B
             on A.Barcode = B.Barcode
         left outer join bookinginformation C
             on B.HID = C.ID
         left join priority E
             on B.Urgent = E.ID
         where B.CreateDate between '2013-01-01 00:00:00' and '2013-01-02 23:59:59' and 
               A.Stage = 0 and 
               C.Flag not between '2' and '3'
        ) idat
    Hope this help.

  3. #3
    Join Date
    Jan 2013
    Posts
    6
    Thanks imex it works..just miss another field..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •