1

I have multiple tables with an account number and a dollar amount.

Table Name: July Accounts

| Account Number | Amount | |------------------|--------| | 1111111111111111 | $99.00 | 


Table Name: August Accounts

| Account Number | Amount | |------------------|--------| | 2222222222222222 | $89.00 | 


I want my results to display as:

| Account Number | July | August | |------------------|--------|--------| | 1111111111111111 | $99.00 | - | | 2222222222222222 | - | $89.00 | 


So far everything I've tried causes something along the lines of:

| Account Number | July | August | |------------------|--------|--------| | 1111111111111111 | $99.00 | $89.00 | | 1111111111111111 | $99.00 | $99.00 | | 1111111111111111 | $89.00 | $89.00 | | 1111111111111111 | $89.00 | $99.00 | | 2222222222222222 | $99.00 | $89.00 | | 2222222222222222 | $99.00 | $99.00 | | 2222222222222222 | $89.00 | $89.00 | | 2222222222222222 | $89.00 | $99.00 | 


Any suggestions?

1
  • Please edit the question to show what commands have you tried. Btw have you heard of UNION? Commented Dec 11, 2014 at 21:40

1 Answer 1

2

You just need to use UNION:

SELECT Account_Number, Amount as July, null as August FROM July_Accounts UNION SELECT Account_Number, null, Amount FROM August_Accounts 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.