Timeline for Getting Skewed Results from LEFT OUTER JOIN with 3 TABLES
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 20, 2017 at 10:21 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Apr 14, 2017 at 3:38 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jun 10, 2015 at 5:17 | answer | added | Rick James | timeline score: 1 | |
Jun 7, 2015 at 15:23 | comment | added | RJ Jacob | @ypercube I have to generate this kind of report a lot in my work and this particular DB (structure) was giving me headaches. I was getting a "mini-cartesian" product and was going about it all wrong. I had tried to do it with sub-queries but your reference made it much clearer. And, it worked! And fast! Thanks again. | |
Jun 6, 2015 at 23:37 | comment | added | ypercubeᵀᴹ |
To solve the issue, you can use derived tables (where you do the group by, separately for each "details" table) and then left join users to these derived tables. See this answer of mine (you can skip the first paragraphs and go to Option 3): Help with this query
|
|
Jun 6, 2015 at 23:32 | comment | added | ypercubeᵀᴹ | The 2 joins from the "master" (users) table to the 2 "details" tables (mghours and mgtraining) produces a mini cartesian product and you'll get wrong results for any user that has more than 1 related rows in each details table. | |
Jun 6, 2015 at 21:46 | review | First posts | |||
Jun 7, 2015 at 0:57 | |||||
Jun 6, 2015 at 21:35 | history | asked | RJ Jacob | CC BY-SA 3.0 |