Return zero when there’s no data

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

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following