AnsweredAssumed Answered

Need your wisdom on a relationship and export issue

Question asked by MatteoPirelli on Jan 26, 2015
Latest reply on Feb 3, 2015 by MatteoPirelli

Title

Need your wisdom on a relationship and export issue

Post

Good day all.

I have this problem that I'm stuck with from quite some time now, without a feasible solution. I'll try to be as concise as possible.

I have three tables: subscriptions, users, magazine issues. Every subscription is tied to a "company_code", and every user has a "company_code". You can have n subscriptions for a given company_code and users on a given company_code. Some sample data:

 

USERS

                                                                                                                       
company codeemail
A000001johndoe@mail.com

 

SUBSCRIPTIONS

                                                                                                                                                                                                                       
company codemagazinestart dateend datesub. type
A00000101MAG01/01/201501/12/2015YEAR

 

MAGAZINE ISSUES

                                                                                                                                                       
magazineissue_codepublication_date
01MAG01MAG1500031201/02/2015

the final outcome I need is a csv file with, on each line:

email, magazine, start date, start issue, end date, end issue

The issue I'm running into are the following:

- the "email" field doesn't get repeated on every line but just on the first occourrence  

- don't know why but i get a lot of empty records with just the magazine_issues for issues that are not  part of the subscription (i have attached a screenshot of the exported file to give you an idea)

I also have attached my relational structure. Is it correct for what i want to achieve? Does anyone has a solution for the non-repeating values for related records?

Thanks in advance for your time.
Matteo

 

 

records.png

Outcomes