Join help

Hi,

I have two tables.

table 1 : ref_forecast_won
This table has the total number of actual sales from year to date, grouped by country and month.

Table 2 ref_forecast_amount
This table has the total number of opportunities being worked on from now to the end of year, grouped by country and month.

I want to join both tables together. So I have the following columns
Month
Country
Total Won
Total Worked on.

select
w.total_won
,w.month
,a.total_opportunity
from ref_forecast_won w
left join ref_forecast_amount a on a.month = w.month and a.market = w.market

Open in new window


My query shows me all data up until month 9 (September) , Where it should me all of the opportunities worked on beyond this date.

Can someone please help?
dan_stanAsked:
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.

SharathData EngineerCommented:
Try this query. If you do not get what you are looking for, post some sample data from both tables with expected result.

select
w.total_won
,w.month
,a.total_opportunity
from ref_forecast_won w
full join ref_forecast_amount a on a.month = w.month and a.market = w.market

Open in new window

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
dan_stanAuthor Commented:
Hi,

Unfortunately I cannot use that function, as it's restricted within Zoho Reports.

I have taken some screen shots so you can get an idea of the data structure.

I have hidden the figures.
total-won.png
total-opportunity.png
0
SharathData EngineerCommented:
Post your expected result.
0
dan_stanAuthor Commented:
Hi,

I figured it out.

i needed to do a union. however i did not explain the question very well, sorry about that.
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
MySQL Server

From novice to tech pro — start learning today.