0

Right now I have two separate tables created as such

SELECT *
  FROM PROD_EDW.ADMIN.FACT_DAILY_DEPOSIT_ACCOUNT_SNAPSHOT ac
  left join PROD_EDW.ADMIN.DIM_ACCOUNT_TYPE actyp on (
     actyp.ACCOUNT_TYPE_KEY = ac.ACCOUNT_TYPE_KEY
  )
LIMIT 100;

SELECT *
  FROM PROD_EDW.ADMIN.FACT_DAILY_ACCOUNT_SNAPSHOT ac
  join PROD_EDW.ADMIN.DIM_ACCOUNT_TYPE actyp on (
     actyp.ACCOUNT_TYPE_KEY = ac.ACCOUNT_TYPE_KEY
     and actyp.ETL_IS_CURRENT = TRUE
  )
LIMIT 100;

I am trying to merge these two tables by the account type key. Any help is appreciated.

I am trying order them by account type key as well. I have 17 million rows and I want to be able to merge and order the data so I can pull some samples out.

McNets
  • 10,352
  • 3
  • 32
  • 61
ColtonMSU
  • 41
  • 6
  • I also forgot to mention I am trying order them by account type key as well. I have 17 million rows and I want to be able to merge and order the data so I can pull some samples out. Thanks – ColtonMSU Mar 01 '18 at 19:54
  • Look at `UNION` and `SELECT INTO` – Syntax Error Mar 01 '18 at 19:58
  • Edit your question and provide sample data and desired results. Although "merge" is a built-in SQL statement (on some databases), it is not really what you want to do. – Gordon Linoff Mar 01 '18 at 20:49
  • I was able to solve the problem. Thanks – ColtonMSU Mar 01 '18 at 20:50
  • When you say 'merge', do you mean you want one table with all the rows from table 1 and all the rows from table2? Or do you want each row of your result to have some data from table1 and some data from table2? It's not clear from your question, and since your SQL uses 'SELECT *' we don't know what columns you have. – tysonwright Mar 01 '18 at 20:51
  • Tag Database you are using – Ven Mar 01 '18 at 21:18

0 Answers0