SQL | How to perform conditional / dynamic joins on multiple tables based on column value

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ธ.ค. 2024

ความคิดเห็น • 21

  • @Jagojoe
    @Jagojoe 2 ปีที่แล้ว +2

    Thank you for the content. When I saw the title I was thinking that "conditional" meant that the join would or would not be executed depending on a criteria but in both examples, the joins are always executed and the displayed value is conditional depending on a criteria.

    • @LearnatKnowstar
      @LearnatKnowstar  2 ปีที่แล้ว

      Thanks for suggesting this scenario. A dynamic SQL might achieve this requirement.
      DECLARE @IsExternal char(1) = 'X'
      DECLARE @sql VARCHAR(MAX) = 'SELECT * FROM Emp E JOIN ' + IIF(@IsExternal = 'X',' DeptExt DE ON DE.DeptId= E.DeptId','Dept D ON D.DeptId = E.DeptId')
      EXEC(@sql)

  • @riddlex
    @riddlex 2 ปีที่แล้ว

    Another useful video. I use the conditional joins at work. We get the correct data only because of it.

  • @vaibhavkhairnar7313
    @vaibhavkhairnar7313 21 วันที่ผ่านมา

    I am union approach
    Just wants to know which one is optimised/ recommend ?

  • @benmatt8940
    @benmatt8940 2 ปีที่แล้ว

    I have a lot of respect for your work, please keep it up

  • @sravankumar1767
    @sravankumar1767 2 ปีที่แล้ว

    Superb explanation 👌 👏 👍 , nice content

  • @database_tips_tricks
    @database_tips_tricks 2 ปีที่แล้ว

    Such useful videos,keep them coming please

  • @TudoEstudado
    @TudoEstudado 2 ปีที่แล้ว

    great job
    best regards
    from Brazil

  • @rk-ej9ep
    @rk-ej9ep 2 ปีที่แล้ว

    Great..

  • @bodasriharshavardhan3367
    @bodasriharshavardhan3367 ปีที่แล้ว

    hi can get classes from your trainings.

    • @LearnatKnowstar
      @LearnatKnowstar  ปีที่แล้ว

      All our video trainings are available on TH-cam. Please SUBSCRIBE for latest videos!

  • @pateldh23
    @pateldh23 2 ปีที่แล้ว +1

    Hello Madam,
    Please make video on following scenario of material requirements.
    Material code, description, base_unit, order unit, daily_requirement, stock_qty, pending_po then total qty(stock_qty+pending_po) and then total qty/daily^requirement as material available for days in sql server and how many different tables I have to create please suggest.
    Thanks in advance for your best help.
    I am waiting for your favourable reply. Please help me...🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

    • @pateldh23
      @pateldh23 2 ปีที่แล้ว

      Please reply or help me

    • @LearnatKnowstar
      @LearnatKnowstar  2 ปีที่แล้ว +1

      Thank you for your comment. MRP is a specialized system and one needs good understanding of the process to implement a solution. There are various vendors like SAP that provide the specialized software.
      If you search for MRP examples and solutions you should be able to get some good references to design your solution. One reference link is copied below -
      www.slideshare.net/LuciaGarrido1/mrp-exercises
      Hope it helps!

    • @pateldh23
      @pateldh23 2 ปีที่แล้ว

      @@LearnatKnowstar I want to create it manually in sql server. So, Please suggest, if possible please make video tutorial on that please