Good day,
Thanks for your nice drawing. It is clear that you made an effort to ask the question in the right way and elaborate with a lot of text. Unfortunately, images are useless and we do not query images but data in tables and instead of stories about your scenario you could simply provide the way to reproduce it - demo it.
- Instead of image of tables, you should provide the queries to create the tables.
- Instead of stories about how the data looks like, you should provide queries to insert some sample data to the tables for the sake of the discussions.
- and finally you should present what is the expected result-SET according the data you inserted to the tables.
- In addition you should add a short description of the business rules - how you get the expected result from the data in the demo tables
- and providing the version of your server will help us to provide a solution that fit your version.
Please always remember these 5 points which you should provide in any question :-)
Back to your question...
What you are asking is to SELECT
data from Dim_Table A
and JOIN
to that data some data from Fct_Table B
. The condition for the JOIN is that the data in the PK column in Dim_Table A
will be the same as the data in column PK in Fct_Table B
SQL language is based on simple English and the solution is a query which looks almost like the above sentence:
SELECT A.PK, A.Col1, A.Col2, B.Col4
FROM Dim_Table A
LEFT JOIN Fct_Table B ON A.PK = B.PK
Notice that this is only an illustration of your case and not necessarily the exact query which you need, since you did not provided the information to reproduce your scenario (as mentioned above in the 5 points). To get the exact solution you will need to provide the information or better... learn about JOIN.
Joining tables is one of the most basic task in SQL queries. You should really go over a simple tutorial from start to end, instead of jumping from one question to the other. Learning the entire SQL language should not take more than 3 full days to someone who speak English (children can learn it at the same age that they learn to write in English).
Here you have a nice tutorial (free online with samples and exercises):
https://www.w3schools.com/sql/
It is NOT RECOMMENDED but if you are really VERY lazy, then at least get more information about joining data of two tables in order to solve your need in this question, here: