Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Problem getting 2 duped records.

$
0
0
SELECT User.LastName,
       User.FirstName,
       User.Middle,
       User.BirthDate,
       User.ID,
       Research.ResearchDateTime,
       Report.ResearchTag,
       Research.UserTag,
       Research.ResearchID,
       ReportSnapshot.ScientistTag,
       ReportSnapshot.ReportTypeStyleSheetTag,
       Scientist.ConfirmationSignature,
       ReportSnapshot.ReportDateTime AS SignedDateTime
  FROM (((Eagle.dbo.Research Research
          INNER JOIN Eagle.dbo.User User
             ON (Research.UserTag = User.tag))
         INNER JOIN Eagle.dbo.Report Report
            ON (Report.ResearchTag = Research.tag))
        INNER JOIN Eagle.dbo.ReportSnapshot ReportSnapshot
           ON (ReportSnapshot.ReportTag = Report.tag))
       INNER JOIN Eagle.dbo.Scientist Scientist
          ON (ReportSnapshot.ScientistTag = Scientist.tag)
 WHERE (ReportSnapshot.ReportDateTime BETWEEN '20130701 00:00:00.000'
                                          AND  '20130711 23:59:59.997')

Sorry but I'm a noob with report writing but I'm having this issue. I wrote the report to show the users seen and the reports completed and when I run it I get the right answers (in a way) but they are all dupped. For some reason the column for ReportTypeStyleSheetTag has a 1 and 2 so I get 2 records for the same person.  All the other colums have EXACTLY the same information EXCEPT this darn ReportTypeStyleSheetTag. Is ther some way I can sum/merge??? I tried just telling it to take just the 1 with

 WHERE (ReportSnapshot.ReportTypeStyleSheetTag IN
              (1))

but 4 months later the report stop working because the ReportTypeStyleSheetTag is now using 3 and 4. So I need a perm fix so I don't have to keep coming back and editing this report.

Please help a noob sql report writer out?



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>