Question

Let say I have 1 parent data and 3 child data like a chain:

Parent -> Child 1 -> Child 2 -> Child 3

using table wizard in the designer I can get any data except that has no Child 3 data in our case. To explain this, let say we have a database like this:

Cars that I own: Car Brands --> Car Models --> Modifications I have 2 data like these:

Ford --> Focus --> Spoiler, Body Kit, New Brake System Mercedes --> C180 --> \No data for modifications, since I dont have any\

Report builder show only the Ford Focus. It does not show mercedes since there is no modification on it. How can I make report builder 3 show all of them?

Or can you suggest any other reporting solution that does at least listing of my data with no visualisations or fancy effects. I need export to excel option only.

Was it helpful?

Solution

The problem is in my select statement:

SELECT
  Kolonminhas.KolonminhaID
  ,Kolonminhas.KolonID AS [Kolonminhas KolonID]
  ,Kolonminhas.Aciklama
  ,Kolonminhas.En AS [Kolonminhas En]
  ,Kolonminhas.Boy AS [Kolonminhas Boy]
  ,Kats.KatID AS [Kats KatID]
  ,Kats.BlokID AS [Kats BlokID]
  ,Kats.Ad AS [Kats Ad]
  ,Kats.Kolonaltkot
  ,Kats.Kolonustkot
  ,Bloks.BlokID AS [Bloks BlokID]
  ,Bloks.ProjectID
  ,Bloks.Ad AS [Bloks Ad]
  ,Kolons.KolonID AS [Kolons KolonID]
  ,Kolons.KatID AS [Kolons KatID]
  ,Kolons.KolonAdi
  ,Kolons.En AS [Kolons En]
  ,Kolons.Boy AS [Kolons Boy]
  ,Kolons.Yukseklik
  ,Kolons.Altkot
  ,Kolons.UstKot
FROM
  Kolons
  INNER JOIN Kolonminhas
    ON Kolons.KolonID = Kolonminhas.KolonID
  INNER JOIN Kats
    ON Kolons.KatID = Kats.KatID
  INNER JOIN Bloks
    ON Kats.BlokID = Bloks.BlokID

To solve this issue OUTER JOIN command should be used. However I am not able to create one. I would appreciate it if someone help me.

And this is the correct query:

SELECT
  Kolonminhas.KolonminhaID
  ,Kolonminhas.KolonID AS [Kolonminhas KolonID]
  ,Kolonminhas.Aciklama
  ,Kolonminhas.En AS [Kolonminhas En]
  ,Kolonminhas.Boy AS [Kolonminhas Boy]
  ,Kats.KatID AS [Kats KatID]
  ,Kats.BlokID AS [Kats BlokID]
  ,Kats.Ad AS [Kats Ad]
  ,Kats.Kolonaltkot
  ,Kats.Kolonustkot
  ,Bloks.BlokID AS [Bloks BlokID]
  ,Bloks.ProjectID
  ,Bloks.Ad AS [Bloks Ad]
  ,Kolons.KolonID AS [Kolons KolonID]
  ,Kolons.KatID AS [Kolons KatID]
  ,Kolons.KolonAdi
  ,Kolons.En AS [Kolons En]
  ,Kolons.Boy AS [Kolons Boy]
  ,Kolons.Yukseklik
  ,Kolons.Altkot
  ,Kolons.UstKot
  from Bloks
  left join (Kats left join (Kolons left join Kolonminhas on Kolons.KolonID = Kolonminhas.KolonID) ON Kats.KatID = Kolons.KatID) ON Bloks.BlokID = Kats.BlokID
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top