Joining multiple data

  • Hi,

    I'm facing an issue.

    I have a database which contains some tables :

    For Eg :

    table 'IDS"

    Data in this table is :

    ID value name firstname

    1 yu ui op

    2 kk pp uu

    IDCondition table:

    ID condition

    1 1

    1 2

    2 2

    2 1

    2 3

    Condition table:

    Condition Name

    1 Ist

    2 Secnd

    3 Third

    Nw my stored proc does this

    Create proc spGetvalue

    bEGIN

    select ID,Value,Name from IDS

    where ID in (1,2,3)

    End

    I want to modify this stored proc to display me 'Conditions' also in the output with multiple conditions seperated by comma

    like Ist,Second

    I don't want to create a temp table to do this

    How can i display one more column "Conditions" in the above output to do this without creating any tempory tables?

    Please help.

  • Have a look at this books online article about joins http://msdn.microsoft.com/en-us/library/ms190014.aspx

    What you probably want to do is join the IDS table to the IDCondition table on the ID columns. If you are still having trouble post what query you have come up with and desired output.

    Bob
    -----------------------------------------------------------------------------
    How to post to get the best help[/url]

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

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