(uspensky (AT) gmail (DOT) com) writes:
Quote:
kind of a tough one i think but any help is appreciated. please try to
stay away from T-SQL... |
You want an MDX query instead? :-)
Quote:
I have a table with products and closing dates for each of 4 quarters
and annual for several years back. (Earning_Dates)
I have another table that has those products with dates and closing
prices. (undPrices)
i have a third table which has the id for all the products.
I need a query that will look at earning_dates and return the latest 6
records for each product.
ALSO
a query which will do that as well as return the closing_price at each
of those 6 dates for each of the products in earning_dates. |
I'm sorry, but I can't connect the product in Earning_Dates to the
columns in undprices or products. I could make a guess, but I don't
like guessing, as it lead me to spend time solving the wrong problem.
Also, I'm uncertaing which are the "latest 6 records".
What all this boils down is the standarad recommendation that posts
of this kind should ionclude:
o CREATE TABLE statements for your tables.
o INSERT statements with sample data.
o The desired output, given the sample.
This makes it possible to copy and paste into to Query Analyzer to
develop a tested solution. Also, by providing the desired result,
we get a better idea of what you are really looking for.
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx