joining two select queries results in one row

  • Hi,

    I want to get output of below query in single row.

    Select 'Name'

    Select 'Surname'

    Expected output is Name,Surname

    Regards,

    Vipin Jha

  • vipin_jha123 (6/12/2015)


    Hi,

    I want to get output of below query in single row.

    Select 'Name'

    Select 'Surname'

    Expected output is Name,Surname

    Regards,

    Vipin Jha

    Continuing with your theme of minimal information:

    Select Name, Surname

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • What if out form both statement comes from 2 different table.

    Regards,

    Vipin jha

  • vipin_jha123 (6/12/2015)


    What if out form both statement comes from 2 different table.

    Regards,

    Vipin jha

    JOIN the tables.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Woke up to this..... Phil you made my Phriday!

    Steve.

  • Phil Parkin (6/12/2015)


    vipin_jha123 (6/12/2015)


    What if out form both statement comes from 2 different table.

    Regards,

    Vipin jha

    JOIN the tables.

    Don't need any JOIN 😛

    DECLARE @Name varchar(255),@Surname varchar(255);

    SELECT @Name = [Name] FROM [table1];

    SELECT @Surname = [Surname] FROM [table2];

    SELECT @Name AS [Name],@Surname AS [Surname];

    :w00t:

    NOTE THIS NOT A REAL ANSWER

    just joining in along the same vein as Phil 😉

    Far away is close at hand in the images of elsewhere.
    Anon.

  • ahh but David, Surname is in table2 not table1. How would we get the value from table2 instead? :hehe:

    Steve.

  • stevefromOZ (6/12/2015)


    ahh but David, Surname is in table2 not table1. How would we get the value from table2 instead? :hehe:

    Deliberate mistake 😛

    😀

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Can we add the address too please...feels somewhat incomplete without it 😀

Viewing 9 posts - 1 through 8 (of 8 total)

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