-
latest update
Hi, I need a query to return the cusip information for the latest updated
price. An example of a row would be:
cusip, date, price, ticker
The table contains price updates for each cusip for a number of different
dates, and I need the price associated with the corresponding date(most recent).
I can get the query below to return the cusip and most recent date, but am
having problems incorporating the price also.
SELECT cusip,
max(priceDate)
FROM price_table
GROUP BY cusip
Thanks....
-
Re: latest update
something like:
SELECT cusip, priceDate, price, ticker
FROM price_table pt1
WHERE priceDate = ( SELECT max(priceDate)
FROM price_table pt2
WHERE pt1.cusip = pt2.cusip )
--
HTH,
David Satz
Principal Software Engineer
Hyperion Solutions
{ SQL Server 2000 SP1/7.0 SP3/6.5 SP5a } { Cold Fusion 5/4.5.1 SP2 } { VSS }
(Please reply to group only - emails answered rarely)
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
-----------------------------------------------------------------
"James" <jbhischke@naspa.net> wrote in message
news:3c0f8d33$1@147.208.176.211...
>
> Hi, I need a query to return the cusip information for the latest updated
> price. An example of a row would be:
>
> cusip, date, price, ticker
>
> The table contains price updates for each cusip for a number of different
> dates, and I need the price associated with the corresponding date(most
recent).
>
> I can get the query below to return the cusip and most recent date, but am
> having problems incorporating the price also.
>
> SELECT cusip,
> max(priceDate)
> FROM price_table
> GROUP BY cusip
>
> Thanks....
>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks