[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Replicate a field based on unjoined tables

Posted on 2008-11-18
Medium Priority
Last Modified: 2012-05-05
I have two tables (table a) has data like this


(table b) has data like this


I need a query that gives me the following results

Year  |  Month
2008     Jan
2008     Feb
2008     Mar
2009     Jan
2009     Feb
2009     Mar

I'm OK on parsing the date from table A  and grouping the years in table B, but I'm not sure how to join them.  The idea is that when a 2010 record is added (in the beginning of 2010) I get...

2008  Jan
2008  Feb
2008  Mar
2009  Jan
2009  Feb
2009  Mar
2010 Jan
2010 Feb
2010 Mar

and so on.. thanks in advance
Question by:jclemo
1 Comment
LVL 14

Accepted Solution

Binuth earned 750 total points
ID: 22991485

select * from
(select mnt from TableA) as TabA,(select DISTINCT YEAR(dt) as dtYear from TableB) as TabB

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question