Go4Expert

Go4Expert (http://www.go4expert.com/)
-   SQL Server (http://www.go4expert.com/forums/sql-server-forum/)
-   -   Joining tables (http://www.go4expert.com/forums/joining-tables-t15291/)

T.Raj 28Nov2008 11:07

Joining tables
 
Hi,
I have 3 tables
Table A
Emp_Name
Emp_ID
Task_Type

Table B
Task_Id
Task_Type

Table C
TaskDescription_Id
TaskDescription
Task_Id


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?

xpi0t0s 28Nov2008 19:32

Re: Joining tables
 
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?

T.Raj 1Dec2008 16:57

Re: Joining tables
 
Hi,
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

xpi0t0s 1Dec2008 17:16

Re: Joining tables
 
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?


All times are GMT +5.5. The time now is 19:30.