Using SQL Server 2012
I have seen a few threads about this topic but I can't find one that involves multiple joins in the query. I can't create a VIEW on this database so the joins are needed.
The Query
SELECT 
      p.Price
      ,s.Type
      ,s.Symbol
      , MAX(d.Date) Maxed
  FROM AdventDW.dbo.FactPrices p
  INNER JOIN dbo.DimSecurityMaster s
  ON s.SecurityID = p.SecurityID
  INNER JOIN dbo.DimDateTime d
   ON
  p.DateTimeKey = d.DateTimeKey
  GROUP BY p.Price ,
           s.Type ,
           s.Symbol
ORDER BY s.Symbol
The query works but does not produce distinct results. I am using Order by to validate the results, but it is not required once I get it working. I The result set looks like this.
Price   Type    Symbol  Maxed
10.57   bfus    *bbkd           3/31/1989
10.77   bfus    *bbkd           2/28/1990
100.74049   cbus    001397AA6       8/2/2005
100.8161    cbus    001397AA6       7/21/2005
The result set I want is
Price   Type    Symbol  Maxed
10.77   bfus    *bbkd           2/28/1990
100.74049   cbus    001397AA6       8/2/2005
Here were a few other StackOverflow threads I tried but couldn't get t work with my specific query
How can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?
SQL Selecting distinct rows from multiple columns based on max value in one column
 
     
     
     
    