none
Remove duplicate values in FULL OUTER JOIN

    Question

  • how can remove duplicate rows in below procedure

    in TBLTicketAnswers i have some record with same TicketID and i don't want to display just one row:

     SELECT  TBLTickets.TicketID ,
                                TBLTickets.UserID ,
                                TBLTickets.AttachFile ,
                                TBLTickets.HasFile ,
                                TBLTickets.Title ,
                                TBLTickets.Question ,
                                TBLTickets.Flag ,
                                TBLTickets.InsertDate ,
                                TBLTicketBranchs.BranchName ,
                                TBLTicketAnswers.AnswerID ,
                                TBLTicketAnswers.Answer ,
                                TBLUsers.UserName ,
                                TBLUsers.UserOwner ,
                                TBLUsers.Corporation
                        FROM    dbo.TBLTicketBranchs
                                INNER JOIN dbo.TBLTickets ON dbo.TBLTicketBranchs.BranchID = dbo.TBLTickets.BranchID
                                INNER JOIN dbo.TBLUsers ON dbo.TBLTickets.UserID = dbo.TBLUsers.UserID
                                LEFT OUTER JOIN dbo.TBLTicketAnswers ON dbo.TBLTickets.TicketID = dbo.TBLTicketAnswers.TicketID
                        WHERE   ( TBLTicketBranchs.ResellerID = @ResellerID   --without flag (@flag=0)
                                  AND ( TBLTicketAnswers.Answer LIKE N'%'
                                        + @Keyword + '%'
                                        OR @Keyword IS NULL
                                        OR TBLTickets.Title LIKE N'%' + @Keyword
                                        + '%'
                                        OR @Keyword IS NULL
                                        OR TBLTickets.Question LIKE N'%'
                                        + @Keyword + '%'
                                        OR @Keyword IS NULL
                                        OR TBLUsers.UserName LIKE N'%' + @Keyword
                                        + '%'
                                        OR @Keyword IS NULL
                                      )
                                )
    TBLTicketAnswers
    -----------------
    AnswerID
    Answer
    TicketID
    ....
    ..


    • Edited by jiji2663 Sunday, July 28, 2013 11:48 AM
    Sunday, July 28, 2013 11:42 AM

Answers

All replies