Mysql – Export database in one file with every dataset existing

csvexcelMySQL

I've got a unusual question.
The human resources needs to export an old DB to a new one.
And the guys managing the new DB wants one csv file with every dataset existing.
I did a Relational database and now i find it difficult to write the select statement.

I did this:

SELECT *
FROM teilnehmer, personen, seminare, termine, kategorien, haeuser
WHERE teilnehmer.sid = seminare.sid  
AND teilnehmer.pid = personen.pid  
AND termine.sid = seminare.sid  
AND seminare.katid = kategorien.katid  
AND personen.hausid = haeuser.hausid
ORDER BY personen.pid

but i only get ~1500 entrys.
I know thats to little, because when i look for a Name and all the workshops he/she did, i get much more than what is in this export.

I don't need the answer i would appreciate if someone could give me a little hint in how to get this done.
Till yet i had only like one join for the data i'd needed to display but this confuses me.

Best Answer

My guess is you need to specify the type of join. You really want a "full outer join" which will not exclude records. A select where you join by keys will default to an inner join.

See https://stackoverflow.com/a/6188334/259538