sql query

  • CREATE TABLE [dbo].[Trans1](

    [RPTTypeCode] [char](2) NULL,

    [Firstname] [varchar](50) NULL,

    [LastName] [varchar](50) NULL,

    [BarrowerID] [int] NULL,

    [LoanTransID] [int] NULL

    ) ON [PRIMARY]

    insert into [Trans1] values('B1','Swathi','B',10,1),('C1','Anu','CH',11,1),('E1','Chintu','KK',13,1)

    CREATE TABLE [dbo].[Trans2](

    [LoanAppID] [int] NULL,

    [LoanTransID] [int] NULL,

    [LoanNumber] [varchar](10) NULL

    ) ON [PRIMARY]

    insert into [Trans2] values(1,1,'ABC123')

    I want query output as below in sinlge row.

    LoanNumber, B1.FirstName, B1.LastName,C1.FirstName,C1.LastName,E1.FirstName,E2.LastName

    I do not want to hardcode "RPTTypeCode" column values because sometimes i get more values in the RPTTypeCode column of Trans1 table.

    Anybody can help me please???

  • Post replies here.

    Please do not post multiple times.

  • Can u please tell the exact scenario, Do u need to show all the entries in trans1 table in single row with the loan Number?

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

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