Skip to content
Advertisement

The multi-part identifier “t7.rate_buy” could not be bound

Please help me on this error message:

The multi-part identifier “t7.rate_buy” could not be bound.

I can’t find how to fix this. I use SQL Server 2012 and I have tried everything but I can’t figure out what the solution is.

Thank you

Advertisement

Answer

You cannot reference another calculated column at the same level of the query as its defined (except for ordering). One solution is to calculate rate_buy as a sub-query e.g.

Given you reference t1 in your 3 sub-queries, that removes the point of having them. I suspect you actually want the following, where t5, t6 & t2 are actually used.

However if that is what you want then you can probably use window function sum rather than a sub-query. I would have a go, but without sample data I can’t work out how that would interact with your massive group by.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement