Combine data of 3 tables into a single row

  • A distributer that only carries 6 items?

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Hi ,

    Yes, that is exactly what I was trying to achieve.

    Thank you so much !

    ----------------------------------------

    stiil not clear...........

    is this the expected output ...eg a table of results?

    USE [tempdb]

    GO

    CREATE TABLE [dbo].[TBL](

    [Cust Id] [nvarchar](50) NULL,

    [col1] [nvarchar](50) NULL,

    [col2] [nvarchar](50) NULL,

    [col3] [nvarchar](50) NULL,

    [col4] [nvarchar](50) NULL

    ) ON [PRIMARY]

    GO

    INSERT [dbo].[TBL] ([Cust Id], [col1], [col2], [col3], [col4]) VALUES (N'Polly Fruitcake', N' Credit Card ', N' Savings Account', NULL, NULL)

    INSERT [dbo].[TBL] ([Cust Id], [col1], [col2], [col3], [col4]) VALUES (N'Joe Blogs', N' Credit Card', N' Cheque Account', N' Investment Account.', NULL)

    INSERT [dbo].[TBL] ([Cust Id], [col1], [col2], [col3], [col4]) VALUES (N'Bilbo Baggins', N' Savings Account', N' Investment Account.', NULL, NULL)

    INSERT [dbo].[TBL] ([Cust Id], [col1], [col2], [col3], [col4]) VALUES (N'G Sus', N' Cheque Account', N' Credit Card ', N' Investment Account.', N' Savings Account')

    SELECT * FROM TBL

  • zaleeu (9/12/2011)


    Hi ,

    Yes, that is exactly what I was trying to achieve.

    Thank you so much !

    ----------------------------------------

    ok...so we now have some clarifcation on what you require.

    Given this table of results, what are you intending to do with it?

    ..still not certain where you are going with this...??

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • OK, so what you're wanting is a list of services that a particular customer has signed up for:

    Name Services

    ----- -------------------------------------------------------------

    Polly Checking, Savings, Credit Card

    Joe Checking, Certificate of Deposit, Credit Card

    Mary Safety Deposit Box, Certificate of Deposit, Savings

    ...

    Right?

    I'd recomend you use the STUFF example that J Livingston SQL suggested a while back.

Viewing 4 posts - 31 through 33 (of 33 total)

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