SQL Server Performance

t-sql error

Discussion in 'SQL Server 2005 General Developer Questions' started by aaron, Jan 23, 2010.

  1. aaron New Member

    I am new to t-sql in the last few months. I am getting the following error in sql server 2005 and would like to know how to get around the problem:
    Msg 4104, Level 16, State 1, Line 1
    The multi-part identifier "Z.MaxReceiveDate" could not be bound.
    The sql that I am running is the following:
    select distinct Z.gnumber, R.Requests, Z.MaxReceiveDate

    from

    (select distinct gnumber,
    count(*) as Requests
    from dbo.table1
    where receive_date > Z.MaxReceiveDate
    group by gnumber
    ) R

    left join
    (select distinct P.gnumber,
    MaxReceiveDate = Max(Received_Date),
    from dbo.table2
    group by P.gnumber
    ) Z
    On Z.HNumber = R.Hnumber
    I am bascially trying to use the maxreceivedate value from a subquery.
    Can you suggest ways to solve this problem?
    Thanks!
  2. preethi Member

    This post is duplicated and answered at
    http://sql-server-performance.com/Community/forums/p/31428/163585.aspx

    Moderators, Can you please do your magic and lock this thread? Thanks,
  3. FrankKalis Moderator

Share This Page