Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9197647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:07:09+00:00 2026-06-17T22:07:09+00:00

I know the question might have not been too clear but I’ll try to

  • 0

I know the question might have not been too clear but I’ll try to explain things better:

I’m building a data warehouse and am working on building a Product dimension table for my ROLAP. The dimension will include the Product, Brand, Client.

So in the OLTP there is a Product table which keys off to Brand table which keys off the Client table. During data entry sometimes the Product isn’t known but the Brand is known, so there are sometimes NULLS in the ProductID fields.

So with the data warehouse, I’m creating views on the OLTP that will used via SSIS to load up the ROLAP. I have a view that will create a list of all the products with their brands and clients in it. What I need to do is find a way to add results to that view that will accommodate if the Product or Brand is Unknown or NULL.

I tried using cross joins but I was getting rows with brands having incorrect contracts and such.

  • Product (ID, ProductName, BrandID)
  • Brand (ID, BrandName, ClientID)
  • Client (ID, ClientName)

The end result I’m going for is:

    [ProductID]  [ProductName]  [BrandID]  [BrandName]  [ClientID]  [ClientName]
      1           ProductA       1           BrandA        1          ClientA
      2           ProductB       1           BrandA        1          ClientA
      3           ProductC       2           BrandB        1          ClientA
      ....
      -2          Unknown        43          BrandABC      33         ClientXYZ
      -3          Unknown        -2          Unknown       34         ClientABC
      -1          Unknown        -1          Unknown       -1         Unknown     

You may ask if the Product is Unknown how would the brand be known? The reason is this system is for customer calls regarding products and sometimes the caller only knows the brand they are calling about.

So anyhow I hope I explained myself well enough and that someone out there has a solution for me. It would be much appreciated!!

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:07:11+00:00Added an answer on June 17, 2026 at 10:07 pm

    To follow up on my comment, here you go — you need to use the COALESCE function:

    SELECT P.Id as ProductId, COALESCE(P.ProductName,'Unknown') ProductName,
       B.Id as BrandId, COALESCE(B.BrandName,'Unknown') BrandName,
       C.Id as ClientId, C.ClientName
    FROM Client AS C
       LEFT OUTER JOIN Brand AS B
          ON C.Id = B.ClientId 
       LEFT OUTER JOIN Product AS P
          ON P.BrandId = B.Id;
    

    And the SQL Fiddle.

    BTW — if you need the negative values instead of NULLs, try this:

    SELECT COALESCE(ProductId, productrn*-1) as ProductId, 
       ProductName, 
       COALESCE(BrandId, brandrn*-1) as BrandId,
       BrandName,
       ClientId, 
       ClientName
    FROM (
    SELECT 
       ROW_NUMBER() OVER(ORDER BY  P.Id) productrn, 
       ROW_NUMBER() OVER(ORDER BY  B.Id) brandrn, 
       P.Id as ProductId, COALESCE(P.ProductName,'Unknown') ProductName,
       B.Id as BrandId, COALESCE(B.BrandName,'Unknown') BrandName,
       C.Id as ClientId, C.ClientName
    FROM Client AS C
       LEFT OUTER JOIN Brand AS B
          ON C.Id = B.ClientId 
       LEFT OUTER JOIN Product AS P
          ON P.BrandId = B.Id
      ) t;
    

    And more fiddle.

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question might have already been discussed a thousands of times but
I know that this question might have been asked like 100 times, but, believe
This question might not seem very technical but, out of curiosity,I want to know
I know this might seem a controversial question but it really is not meant
I asked this same question about a week ago, but I might not have
I know similar questions have been posed before, but I could not find a
I know this might ma a simple question, it must have been answered before
I know this might be a simple question but I have to make sure
I know this question might sound quite silly, but I somehow found myself stuck
I know this question might be little silly but I can't seem to find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.