Question

  Asked: May 20 2008   2:02 AM GMT
  Asked by: DanM


Return zero when there's no data


SQL, Excel 2003, SQL Query, Microsoft Excel, .

I am trying to write a query that I can use to generate an Excel chart to show activity in our database. I have it returning rows for each minute over the previous two hours (no problem). The problem comes when I plot a line chart. If there's no activity in a given minute, there's no row returned, which causes a break in the series on the chart.
How can I write the query to return zero for minutes where there is no activity?

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
-1
Click to Vote:
  •   0
  •  -1



Hello DenM,
you can use the SQL function IsNull, that's to say:

SELECT ISNULL(MYFIELD,0) AS MYVALUE FROM MY TABLE

Bye
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development and Microsoft Windows.

Looking for relevant Development Whitepapers? Visit the SearchWinDevelopment.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register