Display names of another table

David Beltran 0 Reputation points
2023-02-13T15:47:32.2+00:00

I need help doing this realcion by which I have to join these two tables which I have data like:

TABLE: PERSONS

TABLE: OPERATIONS

User's image

and i want to

User's image

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,061 questions
SQL Server Other
{count} votes

2 answers

Sort by: Most helpful
  1. Tom Cooper 8,481 Reputation points
    2023-02-13T16:00:26.0533333+00:00
    Select o.Operation, p.Name As 'Person in Charge',
       r.Name As 'Reviser', op.Name As 'Operator'
    From Operations o
    Inner Join Persons p On o.[Person in Charge] = p.ID
    Inner Join Persons r On o.Reviser = r.ID
    Inner Join Persons op On o.[Operator] = op.ID;
    
    
    0 comments No comments

  2. Anonymous
    2023-02-14T01:48:38.89+00:00

    Hi @David Beltran

    If you want to use a function in your report to do this, you can use the Lookup function, which retrieves the value for a name-value pair from a specified dataset. For detailed usage of Lookup function, you can check this link: Lookup function.

    I simply did a test according to your request. First add the two data sets "ID" and "Operation". Then add the following table and add the expression.

    1

    Person in charge:
    =Lookup(Fields!Persion_in_Charge.Value,Fields!ID.Value,Fields!Name.Value,"ID")
    Reviser:
    =Lookup(Fields!Reviser.Value,Fields!ID.Value,Fields!Name.Value,"ID")
    Operator:
    =Lookup(Fields!Operator.Value,Fields!ID.Value,Fields!Name.Value,"ID")
    

    Preview:

    2

    Best regards,

    Aniya


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.