latest update


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: latest update

  1. #1
    James Guest

    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....




  2. #2
    DaveSatz Guest

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center