2 Replies Latest reply on May 5, 2015 9:09 AM by kettan

    how to strip out duplicate records based on date?

    Joe DeLorenzo

      Hi all -

      We just purchased Tableau literally yesterday and I'm starting to poke around a bit. Typically I do a lot of work in SQL directly and this is something that I would think is easy to do but am having a bit of trouble figuring it out...

       

      Basically, records are stored in a DB that record data for batches as they move through a document imaging process. Batchname, user that did the work, when they did it, what's in it, that sort of thing... If a batch happens to be put through the same step twice due to rework, a second record for that step would be created...

       

      http://imgur.com/ABwrDLA

       

      For this report I don't really care about the earlier times this batch was submitted - I only want the most recent record...

       

      In SQL I would do something like...

      SELECT [batchname], [submittedtime], [documentcount]

      FROM [Capture_Admin].dbo.billingstats b

      WHERE b.batchname LIKE 'NJJ0-2120%'

         AND b.submittedtime =

                (SELECT Max(submittedtime)

                 FROM [Capture_Admin].dbo.billingstats

                 WHERE batchname = b.batchname)

       

      Any help on this would be appreciated. Thanks!