- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2017 03:45 PM
Hi All,
I would like to left join kb_knowledge table with m2m_kb_task so that I can get articles that do not attached to task as well as articles that were attached to task.
Currently, m2m_kb_task provides articles info. that only attached to tasks, But I would want something like above.
So I tried creating a view with left join as below,
View result Showing only inner join:
But keeping Left join True or False doesn't change my result as it is only giving inner join(above pic) that means only records that match the condition specified in where clause.
Can anybody suggest how to achieve this.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2017 06:51 PM
Move the where clause to the second table (m2m_kb_task), like below. You should only need left join true on the second one.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2017 06:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2017 07:36 PM
hey thanks for your response
but that wouldn't give me articles with not attached to task anytime
this is my requirement and I need it very badly
this worked well in SQL I got what I want.
Can you please confirm why I cannot or shouldn't use left join on kb_knowledge
thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2017 07:54 PM
yes it should give you articles not attached to tasks. did you try to set up your DB view like this image below? It will pull all kb_knowledge articles first, and then will left join the m2m_kb_task table to that and the where clause needs to go on that second one. If you set it up like below it should give you what you want, as I did this in my personal instance and it worked fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2017 08:14 PM
Jonathan is correct here. The left join here is going to get all the records from the "left" table here, kb_knowledge, whether it has a corresponding record in the m2m table or not. If you're interested in a different, but similar example with some visuals, take a look at How Do You Report on Nothing?
Good luck, Nari!
Ben