Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6598275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:19:26+00:00 2026-05-25T18:19:26+00:00

In sql server 2005, how do I get the result set in table3 below?

  • 0

In sql server 2005, how do I get the result set in table3 below? table3 is created by combining table1 and table2 like this:

table1.empid
table1.ticket
table2.identid

And update against table1 joined to table2 doesn’t work because empid isn’t unique. If need to increment to the next table2.indentid if the ID is already being used by that employee.

Also, table3 below isn’t created yet. It’s a generated set from table1 and table2. I’m using table3 as an example of what the generated set should look like.

table1
empid   ticketid   indentid
1       7          20
1       9          4
2       9          21

table2
indentid   empid
90         1
91         1
92         2

table3 
empid   ticketid  table1_indentid    table2_identid
1       7         20                 90
1       9         4                  91
2       9         21                 92
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:19:27+00:00Added an answer on May 25, 2026 at 6:19 pm

    The only connection between table1 and table2 is empid.
    The lines 1 and 2 of your table3 example have the same empid, so they should have the same table2_identid as well. Your example is not proper, or not possible to get with a query on the existing data.


    But maybe this is what you want:
    If you join the tables like so

    SELECT empid, ticketid, t1.indentid as table1_indentid, t2.identid as table2_identid
    FROM table1 AS t1
        INNER JOIN table2 AS t2 ON t1.empid = t2.empid
    

    you will get

    table3 
    empid   ticketid  table1_indentid    table2_identid
    1       7         20                 90
    1       7         20                 91
    1       9         4                  90
    1       9         4                  91
    2       9         21                 92
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a database (SQL Server 2005) which we would like to get under
I'm using SQL Server 2005 and would like to know how I can get
How to get last page no like stackoverflow.com pagination in Sql server 2005
SQL Server (2005/2008) Each of the below statements have the same result. Does anyone
SQL Server 2005 I have the following result set: ID name prop value --------------------------
In SQL Server 2005 Express, the result is below SELECT 100 / 15 --Result
Sometimes I get the following from SQL Server 2005 when executing a stored procedure:
I get the following error message in SQL Server 2005: User '<username>' does not
Is there a way to get stored procedures from a SQL Server 2005 Express
I am trying to get IS_MEMBER working in a UDF in Sql Server 2005.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.