Forums

This topic is locked

Query based on SUM

Posted 21 Jan 2005 11:12:50
1
has voted
21 Jan 2005 11:12:50 Chriz L. posted:
Hello all,

I have two questions in SQL Queries:

1. How do i represent a blank field? I use " " but i get no responses when i execute the query.

2. How can i create a query based on the sum of two field? What i mean:
I have a table named Applications with fields Num2 and Num1. I want to have a query based on Num(=Num1+Num2). Is it possible?

Thank you in advance


Edited by - dealwi8me on 22 Jan 2005 13:33:10

Replies

Replied 21 Jan 2005 12:11:47
21 Jan 2005 12:11:47 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>...1. How do i represent a blank field? I use " " but i get no responses when i execute the query.<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Have you tried <i>NULL</i>?
Replied 21 Jan 2005 12:23:25
21 Jan 2005 12:23:25 Dave Thomas replied:
<pre id=code><font face=courier size=2 id=code>
SELECT SUM (num1 + num2)
FROM Applications;
</font id=code></pre id=code>

or something along them lines, for a formula based query.
u may need to use it as
<pre id=code><font face=courier size=2 id=code>SELECT SUM (formula) as 'Num'</font id=code></pre id=code>

regards
Dave
Replied 21 Jan 2005 15:30:43
21 Jan 2005 15:30:43 Vince Baker replied:
use the % symbol as a wild card for nil values.....this onlly works with text. You cannot use it for numerics.

make sure you use Select Sum(num1 + num2) as something. A name will be required to use the query results on a page.

Regards
Vince

DMX Talkzone Manager

Visit my home: www.chez-vince.com
(Now completely CSS based and bye bye to all tables!)

VBScript | ASP | HTML | CSS | SQL | Oracle | Hosting
Replied 21 Jan 2005 16:44:44
21 Jan 2005 16:44:44 Chriz L. replied:
Thank you!

I tried them all and they work just fine <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic