Select statement in SQL to create a new table

I would like to create a new table D  from all elements in table A, all elements in Table B but only two elements from Table C.  The two elements are Element_A and Element_B.
Can someone tell me the most efficient way to code this statement.
moriniaAdvanced Analytics AnalystAsked:
Who is Participating?
 
ambidextrousConnect With a Mentor Commented:
How about this?

Create Table ER_Members_Cases as
      Select m.*, e.column1, e.column2 From Case_Members m, ER_Case e
      where m.membno = e.membno;
Quit;
0
 
Patrick MatthewsCommented:
INTO will create a new table from the results of a query:

SELECT <columns>
INTO NewTableName
FROM <tables>
WHERE <criteria>

Your question does not really provide enough information to go much beyond that.
0
 
moriniaAdvanced Analytics AnalystAuthor Commented:
matthespatrick


The statement I have below is creating  table ER_Members_Cases.  The way it is coded now I am getting all of the columns from both Case_Members and ER_Case.  I was wondering if there was a way other than listing all of the columns to get all of the columns from one table using the * and only two columns from the other table.  FYI  this is a PROC statment in SAS using  PROC SQL

Create Table ER_Members_Cases as
      Select * From Case_Members m, ER_Case e
      where m.membno = e.membno;
Quit;
0
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.

All Courses

From novice to tech pro — start learning today.