Topic
1 reply Latest Post - ‏2013-07-29T20:24:52Z by GeneCobb
Heff
Heff
4 Posts
ACCEPTED ANSWER

Pinned topic How do I create summary metadata?

‏2013-07-19T06:08:03Z |

Hi,

This may be a bit of an entry level question, but how do I create summary meta data?

I was looking for something like getting the latest price from a price list, SQL could be:

SELECT ItemId, Price, PriceDt from PRICES P1

where PriceDt = (SELECT max(P2.PriceDt) from PRICES P2 where P2.ItemId = P1.ItemId)

Any help would be much appreciated, even if it is just pointing me to the right friendly manual...

Cheers,

Peter

 

  • GeneCobb
    GeneCobb
    371 Posts
    ACCEPTED ANSWER

    Re: How do I create summary metadata?

    ‏2013-07-29T20:24:52Z  in response to Heff

    Hi Peter - sorry for delayed response. The technique that I would recommend here is to create an SQL view to perform the specific type of summary function. So something like this:

    CREATE VIEW MyLib/MyView AS
    SELECT ItemId, Price, PriceDt from PRICES P1
    where PriceDt = (SELECT max(P2.PriceDt) from PRICES P2 where P2.ItemId = P1.ItemId)

    Then create a synonym over the view.