1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Joining tables

Discussion in 'SQL Server' started by T.Raj, Nov 28, 2008.

  1. T.Raj

    T.Raj New Member

    I have 3 tables
    Table A

    Table B

    Table C

    Instead of values for Task_Type and TaskDescription i want to have their ID in Table D with Emp_Name, Emp_ID, Task_Id, TaskDescription_Id

    I tried inner , left outer join but but it does not give me the correct value

    SQL statement is

    Select A.Emp_Name, A.Emp_ID, B.Tak_Id, C.TaskDescirption_Id from Table A
    left outer join Table B on A.Task_Type = B.Task_Type
    left outer join Table C on B.Task_Id = B. Task_Id

    What am'i doing wrong?
  2. xpi0t0s

    xpi0t0s Mentor

    I don't understand the question. What's the relevance of Table D?
    What are you trying to do, create a table or run a query? Or both, i.e. are you doing create table d as select...?
    If a query, what columns do you want the query to display?
  3. T.Raj

    T.Raj New Member

    I'm trying to upload data from an old database to new database and we are using ID's into the main table for some of the standard value like TABLE B and TABLE C which will have some standard values records.
    I have copied these old standard tables without ID numbers to new tables with ID numbers. Now i'm trying to copy the main tables where i have these standard values in some of the records instead of the values i want to compare the values and get the ID from TABLE B and TABLE C
  4. xpi0t0s

    xpi0t0s Mentor

    I still don't clearly understand the basic goal you're trying to achieve. Could you give a couple of example rows for each relevant table, and what data you want to end up where?

    Does table D contain the "old" data that tables A-C now contain in the new format (with IDs)?
    If not, what tables exist in the old format?

Share This Page