locked
Join with like clause RRS feed

  • Question

  • User229488726 posted

    join more the 3 table work perfecta but when i use like operate    in where clause  no data return 

    this is my sql query whats wrong with this please help me 

    select distinct c.*,(s.[Name] +' '+s.[Sname]) as Name,t.[Name]+' '+t.[Sname] as Teachername from [dbo].[Choose] c
    left join [dbo].[Student] s on s.Id=c.ChooseStudent join [dbo].[Teacher] as t on c.[ChooseTeacher]=t.Id where
    t.[Sname] like '%prashant dixit%' order by c.Id desc

    Monday, March 28, 2016 2:22 PM

Answers

  • User77042963 posted

    Run this to see whether you have any rows returned:

    select distinct c.*,(s.[Name] +' '+s.[Sname]) as Name,t.[Name]+' '+t.[Sname] as Teachername 
    from [dbo].[Choose] c 
    left join [dbo].[Student] s on s.Id=c.ChooseStudent 
    join [dbo].[Teacher] as t on c.[ChooseTeacher]=t.Id 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 28, 2016 6:27 PM