The column prefix does not match with a table name

  • I have the following query:

    select moncalladd.opname, moncalladd.schedname, moncalladd.firstlisting,

    DATEADD(MINUTE, moncalladd.AddTime, DATEADD(DAY, moncalladd.AddDate, '12/31/1899')) as added,

    moncalladd.initials, dateadd(n,moncalladd.Timestamp, '12/31/1899')-(moncalladd.timestamp/1000)/60/1440 +1 as oncalldate

    from mdr.dbo.moncalladd inner join mdr.dbo.moncalldelete

    on moncalladd.schedname = moncalldelete.schedname and moncalladd.timestamp= moncalldelete.timestamp

    WHERE dateadd(n,moncalladd.Timestamp, '12/31/1899')-(moncalladd.timestamp/1000)/60/1440+1 >= '03-21-2011' and moncalladd.schedname='CAP.NEURO'

    order by oncalldate

    If I run that query as is .. it runs fine but when I add the following line:

    dateadd(n, moncalladd.startoncalldate, +1)+(moncall.startoncalltime/1440)+(moncalladd.Duration/1440) as addeddate,

    anywhere in my query I get this error:

    The column prefix 'moncall' does not match with a table name or alias name used in the query.

    What am I not seeing here?

    Thank you

    Doug

  • You're using just moncall in your middle expression, not moncalladd or moncalldelete... that table isn't in your query.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply