Solved

need help with this SQL

Posted on 2007-04-05
2
254 Views
Last Modified: 2013-12-11
i have the following table called TBLA
ID number
NAME varchar2
CLOSE_FLAG varchar2

I want to populate TBLA from TBLB
CUST number
CUST_NAME

and insert a 'N' to CLOSE_FLAG

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is my SQL

insert into TBLA values(
(select CUST    from TBLB),
(select CUST_NAME from TBLB),
 'N');

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 THIS IS WHAT I WANT TO DO..

take CUST and CUST_NAME from TBLB and insert it into TBLA , rows CUST and CUST_NUMBER, and insert an 'N' into CLOSE_FLAG
0
Comment
Question by:joekeri
2 Comments
 
LVL 11

Accepted Solution

by:
dready earned 50 total points
ID: 18862140
insert into tbalA (ID, Name, CLOSE_FLAG)  select CUST, CUSTNAME, 'N' from tblB

Or, if the names of the columns in tblA are CUST and CUST_NUMBER like you wrote in the last sentence:

insert into tbalA (CUST_NUMBER, CUST, CLOSE_FLAG)  select CUST, CUSTNAME, 'N' from tblB
0
 

Author Comment

by:joekeri
ID: 18864892
excellent!!! bang on !!! to what i was tryign to do.. Thanks for your help....
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.‚Äč
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to recover a database from a user managed backup

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now