SQL to append data to one fixed table...

Hi Experts

I am after some SQL code for Oracle Discoverer.....which does the following sequence of steps:

1. Run a SQL Code to pull data back from tables A, b and c (staff details)
2. then append this data to a master table.
2. then repeat step 1, with a slight change in SQL criteria and append the results back to step 2 the master table..

so each time I change the selection criteria I want the end result to end up in the master table.
route217JuniorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Helena Markováprogrammer-analystCommented:
I think that you can use
insert /*+ append */
into <<your master table>>
select
0
route217JuniorAuthor Commented:
Hi henka

this is the first time I am writing SQL...could you kindly put together a simple sample SQL Statement. please.

and much appreciated for the feedback.
0
Vitor MontalvãoMSSQL Senior EngineerCommented:
You didn't give sample data so we can't provide you with the exact SQL statement but here is something than can help you:

1. Run a SQL Code to pull data back from tables A, b and c (staff details)

 SELECT *  FROM tableA;
  SELECT *  FROM tableB;
  SELECT *  FROM tableC;

2. then append this data to a master table

 INSERT INTO masterTable
  SELECT *  FROM tableA;

  INSERT INTO masterTable
  SELECT *  FROM tableB;

  INSERT INTO masterTable
  SELECT *  FROM tableC;

3. then repeat step 1, with a slight change in SQL criteria and append the results back to step 2 the master table..

 INSERT INTO masterTable
  SELECT *  FROM tableA
  WHERE columnName = Criteria;

  INSERT INTO masterTable
  SELECT *  FROM tableB
  WHERE columnName = Criteria;

  INSERT INTO masterTable
  SELECT *  FROM tableC
  WHERE columnName = Criteria;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
route217JuniorAuthor Commented:
Vitor Montalvão

many thanks for the excellent feedback let me test...
0
Helena Markováprogrammer-analystCommented:
It is difficult to put here sample statement, because I don't know your tables.

In this documentation (registration is free) you can find a lot of examples:
http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_9014.htm#SQLRF01604
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.