I am having troubles when i want to create a named calculation from two different tables.

I have the table "CallesDim" with an id(PK) and a description and the table "UbicacionesDim" with an id (PK), another id (FK to "CallesDim") and a description:

--

CallesDim

  • id PK
  • Descripcion VARCHAR

--

UbicacionesDim

  • id PK
  • CalleId FK to id from CallesDIM
  • Altura INT

--

I want to concatenate "Descripcion" from "CallesDim" with Altura from "UbicacionesDim".

I try doing this:
CallesDim.Descripcion + ' ' + CONVERT(VARCHAR,UbicacionesDim.Altura)
but i am having the following error:

the multi-part identifier "CallesDim.Descripcion" could not be bound

Any ideas? Thanks!

有帮助吗?

解决方案

In a named calculation you can only access columns from the table that it is defined on.

Which record of the other table should it take in case it would accept columns from other tables? How should it join? All this cannot be configured.

If you need to join two (or more) tables, you can define a named query that can contain joins and access as many tables as you like. A named query can contain everything that you can state in a single select statement.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top