Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6880967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:02:54+00:00 2026-05-27T05:02:54+00:00

I cant figure out why this code executes as a query but when I

  • 0

I cant figure out why this code executes as a query but when I execute it in a view it throws a the multi-part identifier could not be bound, error.

When I take out the case statement It works in the view, so I believe it is something that has to do with the case statement.

Any suggestions are appreciated.

WITH [cteFrostSum] AS
(
    SELECT ID AS ID, theMonth  as Mo,
    SUM(dbo.Frost.[DRAmount])  AS [DRAmount]
    FROM dbo.Frost 
    GROUP BY [ID], theMonth
) 
SELECT DISTINCT 
    TOP (100) PERCENT      
    dbo.ternean.MemberID, 
    dbo.ternean.SSN, 
    dbo.ternean.GroupName, 
    dbo.ternean.CustomerID, 
    dbo.ternean.GroupNumber, 
    dbo.ternean.LastName, 
    dbo.Frost.DRAmount, 
    dbo.Frost.HittheBank, 
    dbo.Frost.MonthofPremium, 
    cte.[DRAmount] AS [SUM_Frost_Balance],
    dbo.ternean.TotalCost,
    cte.[DRAmount] - dbo.ternean.TotalCost AS Diff,
    dbo.ternean.ACH_RoutingNo, 
    dbo.Frost.RTNum, 
    dbo.ternean.ACH_AcctNo,
    dbo.Frost.AccountNumber, 

    CASE
        WHEN dbo.Frost.RTNum <> SUBSTRING(dbo.ternean.ACH_RoutingNo, 2, 20)
            THEN 'DO not match'
        WHEN dbo.Frost.RTNum = SUBSTRING(dbo.ternean.ACH_RoutingNo, 2, 20)
            THEN 'match'
    END AS [Routing # match], 
    CASE
        WHEN SUBSTRING(dbo.ternean.ACH_AcctNo, 2, 20) <> dbo.Frost.AccountNumber
            THEN 'DO not match'
        WHEN SUBSTRING(dbo.ternean.ACH_AcctNo, 2, 20) = dbo.Frost.AccountNumber
            THEN 'match'
    END AS [Account # match],
    dbo.Frost.theMonth
FROM dbo.Frost
INNER JOIN dbo.ternean ON dbo.Frost.ID = dbo.ternean.CustomerID
    AND dbo.Frost.theMonth = dbo.ternean.theMonth 
INNER JOIN [cteFrostSum] cte ON dbo.Frost.ID = cte.ID
    AND dbo.Frost.theMonth = cte.Mo
ORDER BY dbo.ternean.theMonth
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:02:55+00:00Added an answer on May 27, 2026 at 5:02 am

    I tried to replicate your error but couldn’t.

    Why are you using multi-part identifiers the field names anyway? The list of fields in the select statement can only refer to the tables in the from clause, at first reading this query seems to be referring to the tables directly in the dbo schema.

    Give your tables some nice easy aliases i.e.

    FROM dbo.Frost AS F
    

    and use them like this

    F.RTNum
    

    Secondly you can simplify your case statements and only do one test i.e.:

    CASE WHEN SUBSTRING(T.ACH_AcctNo, 2, 20) <> F.AccountNumber
        THEN 'DO not match'
        ELSE 'match'
    END AS [Account # match]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting segmentation fault in this code but i cant figure out why.
I realize this perhaps a naive question but still I cant figure out how
I want to do something but cant figure out how to do this (i
I have found this script and cant seem to figure out why it throws
what is wrong with this sql query. i cant figure it out. $query =
I can't figure out the use for this code . Of what use is
Can't seem to figure this out, see code below. Trying to make a GET
I can't figure this out. I have the following code: import java.util.ArrayList; import java.util.List;
I'm getting the error: the multi-part identifier IC.industry could not be bound when making
I can't quite figure out this syntax problem with a case expression in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.