Is it possible (if so , how) to filter out Distinct values from a Query that uses two

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gberisha
    New Member
    • Apr 2012
    • 1

    Is it possible (if so , how) to filter out Distinct values from a Query that uses two

    HI,


    I've got a little question regarding SSReportingServ ices,

    I am trying to build a report using 3 different tables , say : Computer , CoWorkers, Harddrive,

    In the query I took the "Computer" table 2 times , Coworkers and Harddrive (Computer 2 times because if I only use one and join it with CoWorkers and Harddrive I loose certain values that aren't on the Harddrive Table , so I am joining Computer with Coworkers and than Coworkers with Computer_1 and the latter with Harddrive)


    The problem I have is that as a result I am getting Twice the values from the Computer Table Each time , and therefore needed to know , if there was a possible way for me to filter out distinct values.


    Thnx in Advance

    Query :

    SELECT DISTINCT
    Computer.Modell , Computer.Name, Computer.antivi r, Computer.LastUp date, Coworker.Login, Harddrive.Statu s,
    Harddrive.LastO nline

    FROM Computer INNER JOIN
    Coworker ON Computer.Cowork erID = Coworker.ID INNER JOIN
    Computer AS Computer_1 ON Coworker.ID = Computer_1.Cowo rkerID INNER JOIN
    Harddrive ON Computer_1.Comp uterID = Harddrive.Compu terID
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    I don't think you need to double-join coworker and computer. You're not even using any column from computer_1.

    That could be one of the reason why you have duplicate. If you think you're missing some rows, it could be that your JOIN is INNER, not LEFT.

    Happy Coding!!!


    ~~ CK

    Comment

    Working...