Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
UsePowerBI
Post Prodigy
Post Prodigy

Issue with SQL statement

Hello

 

I use the following SQL statement but it only shows the Table4's values and all the rest values from the fields of the other tables are null.

 

SELECT * FROM Table1
LEFT JOIN Table2
ON Table1.Col1 = Table2.Col2
LEFT JOIN Table3
ON Table2.Col4 = Table3.Col5
RIGHT JOIN Table4
ON Table2.Col6 = Table4.Col7

 

Any idea?

 

Thanks!

5 REPLIES 5
Pragati11
Super User
Super User

Hi @UsePowerBI ,

 

Not sure if I understand your issue correctly.

 

Are you using this sql query in Power BI or you want to replicate similar query in Power BI?

 

Please add details: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

hi @Pragati11 

 

I am putting this SQL statement in Power BI but it does not produce the result it should. The statement might be wrong, any hint?

 

Thanks

Hi @UsePowerBI ,

 

Try replacing the highlighted section as shown below with Table3.Col5:

Pragati11_0-1602515085286.png

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi @Pragati11 

 

Thanks but Table4.Col7 can only be joined with Table2.Col6. The Table3.Col5 is not relevant to Table4.Col7.

 

Any other idea?

Hi @UsePowerBI ,

 

It is very difficult to analyze without looking at the data and just by imagining.

Is this statement correct in SQL?

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.