Need help with query

  • Hi All,

    I need help with the following query:

    LinksTable looks like this:

    LinkId Name

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

    5070 myapp

    5071 myapp

    5073 myapp

    1 another app

    3 anotherapp

    xRef table looks like this:

    EmployeeId LinkId LinkName

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

    2 4 anotherapp

    7 6 anotherapp

    8 5 anotherapp

    I need to add entiries into the xRef table as:

    EmployeeId LinkId LinkName

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

    2 5070 myapp

    7 5071 myapp

    8 5073 myapp

    In other words, take employeeid from xRef table where LinkName = 'anotherapp'

    and insert records into xRef with that employeeid and get the linkId and LinkName from

    Linkstable and insert it into xRef along with the employeeid.

    How do I do that?

  • Is this a set structure, the data does not look particulary normalised.

    MCITP SQL 2005, MCSA SQL 2012

  • Can anyone help please.

  • We can probably help. it will most likely take 2 inserts. other than that not much any one else can do with out sample data and table definitions.

    Please see http://www.sqlservercentral.com/articles/Best+Practices/61537/ for more information


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

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

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