locked
Inner Join Problem RRS feed

  • Question

  • User197255166 posted

    Hi everyone,

    I'm making an Inner Join. As an example Solution tablom there is a Solution Category tablom that is bound to it. The following query returns 2 records when the result is 1 record. What is the reason of this.

      select TS.CozumAd from T_SolutionSubCategory TS INNER JOIN 
      T_Solution TL on TS.SolID = TL.ID

    Monday, August 20, 2018 1:36 PM

All replies

  • User-82109136 posted

    I think you forgot the query

    Monday, August 20, 2018 2:10 PM
  • User197255166 posted

    Thank you.. I shared my code.

    Monday, August 20, 2018 3:06 PM
  • User1120430333 posted

    Thank you.. I shared my code.

    So you  did an inner join. So what's the problem, since you are giving no explanation about any thing and you picture doesn't work?

    Monday, August 20, 2018 9:48 PM
  • User1724605321 posted

    Hi Aliyillmaz,

    What is the your expected result  ? And here are some tips about SQL join :

    Best Regards,

    Nan Yu

    Tuesday, August 21, 2018 3:18 AM
  • User197255166 posted

    there are two results here. I need only one result.

    Tuesday, August 21, 2018 9:00 PM
  • User1724605321 posted

    Hi Aliyilmaz,

    There will be two results as you can find the TS.SolID(1,2) equal TL.ID(1,2) , can you clearly  which record  is the expected one and what is the condition .

    Best Regards,

    Nan Yu

    Wednesday, August 22, 2018 6:43 AM
  • User197255166 posted

    Hi,

    in fact I want to do is come up with 1 on a fixed page. How can I do that. I am using entity framework and linq to sql.

    Wednesday, August 22, 2018 10:38 AM
  • User1724605321 posted

    Hi Aliyilmaz ,

    For example :

    from s in db.T_SolutionSubCategory
    join sa in db.T_Solution on s.SolID equals sa.ID
    where s.ID == 1
    select s

    Where db is your DbContext .

    Best Regards,

    Nan Yu

    Thursday, August 23, 2018 6:09 AM
  • User-2054057000 posted

    The query returns correct result. See the on keyword where you have applied the conditions. 2 records matches so you get 2 records as output. 

    Friday, August 24, 2018 11:43 AM