View previous topic :: View next topic
|
Author |
Message |
poongs Warnings : 1 New User
Joined: 24 Jan 2007 Posts: 28 Location: pune
|
|
|
|
I have 3 tables say A, B and C. Tables A and B are similar with columns having same datatypes except that table B has an additional column. I would like to get the details of this additional colum from table C.
The functionality needs to be something like the one below
For ex, if table A has columns 1,2,3,4
Insert into A
(select 1,2,3 from table B (and for the 4th column) select 4 from table C) |
|
Back to top |
|
|
sainathvinod
New User
Joined: 01 Apr 2008 Posts: 11 Location: Chennai
|
|
|
|
Could you please make you question a bit more clear? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
To best receive suggestions that will provide a solution to your requirement, you need to post some sample rows from the tables and what the outcome should be of processing those rows.
Include both rows that will cause an insert in tableA and rows that will not. Once you show approprite data and clearly explain the "rules", you wil receive something useful rather than more questons. |
|
Back to top |
|
|
sainathvinod
New User
Joined: 01 Apr 2008 Posts: 11 Location: Chennai
|
|
|
|
Please try this query........ I'm not sure if my understanding is correct:-
INSERT INTO A
(SELECT B.1,
B.2,
B.3,
C.4
FROM B,C
WHERE B.(JOINING FIELD WITH TABLE C) = C.(CORRESPONDING JOINING FIELD WITH TABLE B)
) |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Sainath,
Quote: |
I'm not sure if my understanding is correct:- |
I wasn't sure either Which is why i asked for clarification.
Hopefully, your understanding is correct
d |
|
Back to top |
|
|
|