sql get latest unique
Posted on 2011-03-25
what to retrieve a unique count of records ... when an db update is processed an new copy of the record is actioned (to preserve this historic data) ... so for example, the same account details may appear 3 or 4 times already ...but only want to count the latest copy.
there is also a DateTimeStamp column available (when table created / add to db)
need to also group results by ColumnValue item (there will be a bunch of denominations) -- but the frequency each of those occur ... and then finally a grand total of Frequency at the bottom.
how do you script this in SQL please?
SELECT COUNT(Index_ID) AS Frequency
WHERE (MySearchCriteria_ID <> 123) AND .....
GROUP BY DenominationValue
then display at bottom: GrandFreqTotal