Help with SQL Query for Graph

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • -cicada-

    Help with SQL Query for Graph

    Hello All,

    I have a database of various artist's average annual auction prices,
    which I would like to graph. In some years there are no sales for an
    artist, and therefore no data for that artist for that year, in the
    table.

    However in selecting the years to graph, I want to commence with the
    current year and work back through the data until I reach a year with
    no data, so that the graph covers an unbroken period.

    For example in the table below, the period to be graphed would be 2000
    to 2007, being the unbroken period working back from 2007, as there is
    no data for 1999.

    1996 $1,300
    1998 $1,500
    2000 $1,800
    2001 $1,900
    2002 $1,600
    2003 $2,100
    2004 $2,400
    2005 $2,600
    2006 $1,800
    2007 $2,200

    The length of the period to be graphed will vary from artist to
    artist, but all will have a common starting point of the current year,
    and work back from there.

    Can this be accomplished with a SELECT statement? If not, any ideas as
    to how it can be done?

    Many thanks in advance,

    John Furphy

Working...