Re: sql query help join
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Fri, 17 Feb 2006 23:13:31 +0000 (UTC)
(uspensky@xxxxxxxxx) writes:
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? :-)
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@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- sql query help join
- From: uspensky
- sql query help join
- Prev by Date: Re: with nolock problem
- Next by Date: Can SQL Server work with a Paradox table?
- Previous by thread: sql query help join
- Next by thread: Business-to-Business Data Integration in a SOA World
- Index(es):
Relevant Pages
|