[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

need help with this SQL

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
joekeri
Asked:
joekeri
1 Solution
 
dreadyCommented:
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
 
joekeriAuthor Commented:
excellent!!! bang on !!! to what i was tryign to do.. Thanks for your help....
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now