2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-25 22:38:04 +02:00
Commit graph

2 commits

Author SHA1 Message Date
Stefan Koch
756fee46ef left join sufficient
A LEFT (OUTER) JOIN is totally sufficient here, you do not want to have one Berater NULL with about 10 customers (because some customers do not have a Berater).

Moreover, when using the altered version as expected (i.e. the one with Kunden2Berater table) there is no column Kunden.berater_id anymore. You thus have to join Kunden2Berater.

I have NOT checked the COUNT throroughly, but according to my understand you will have to count on one of the Kunden2Berater columns, because COUNT() will ignore NULL columns and this is what we want. If LEFT JOIN returned a row where there are no columns on the right side, the count shall give NULL. Yet, I have to admit that I do not understand COUNT() too well. The DISTINCT is then unneeded, because we GROUP BY berater_id and the kunden_id for each berater itself will already be unique. So please do not take the COUNT statement for granted now, it's untested. http://www.techonthenet.com/sql/count.php
2013-07-30 11:14:45 +02:00
Martin Thoma
a430494180 misc 2013-07-27 15:29:03 +02:00
Renamed from documents/musterloesung-db-aufgabe-d1/d3d.sql (Browse further)