Return zero when there’s no data

5 pts.
Tags:
Microsoft Excel
Microsoft Excel 2003
SQL
SQL Query
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?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hello DenM,
you can use the SQL function <i>IsNull</i>, that’s to say:
<pre>
SELECT ISNULL(MYFIELD,0) AS MYVALUE FROM MY TABLE</pre>
Bye

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: