954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

sql commad problem

In a data environment I write code like:
select ([exam fee]*[other fee]) as total from table1
then it work, but when I write like below it not work:
select sum[exam fee] as total from table1
what problem with it?

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

How does it not work?

and should that not be ([exam fee] + [other fee])

Good Luck

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

another thing. I write like:
"select sum[exam fee] as total , sum[other fee] as total_fee from table1"
it not work

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

Are the fields numeric? If not that could be your problem but without seeing your code who knows.


Good Luck

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

ya that field are numeric.

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

NOTE:

sum[exam fee]  ==>   sum([exam fee])
Mbt925
Junior Poster in Training
63 posts since Dec 2007
Reputation Points: 10
Solved Threads: 5
 

NOTE:

sum[exam fee]  ==>   sum([exam fee])


I don't understand by this code. I want sum[exam fee] and sum[other fee]. is it possible with your code?

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 
I don't understand by this code. I want sum[exam fee] and sum[other fee]. is it possible with your code?

yes.
SUM is a sql function. you must use '(' & ')' for it.

change your code in this way:

"select sum<strong>(</strong>[exam fee]<strong>)</strong> as total , sum<strong>(</strong>[other fee]<strong>)</strong> as total_fee from table1"
Mbt925
Junior Poster in Training
63 posts since Dec 2007
Reputation Points: 10
Solved Threads: 5
 

thanks Mtb 925. it works well. another thing when I input exam fee in a form and when I see the report it not update. I mean exam fee is 200 and I add again 200. so report will show 400/ but it show 200, when I exit and again open the project then show 400. please help me

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 
thanks Mtb 925. it works well. another thing when I input exam fee in a form and when I see the report it not update. I mean exam fee is 200 and I add again 200. so report will show 400/ but it show 200, when I exit and again open the project then show 400. please help me

Your welcome.

you must reconnect it. attach your sample. i will edit it.

Mbt925
Junior Poster in Training
63 posts since Dec 2007
Reputation Points: 10
Solved Threads: 5
 

you must reconnect it
reconnect mean......................

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 
you must reconnect it reconnect mean......................

reconnect meanattach your code. :icon_wink:

Mbt925
Junior Poster in Training
63 posts since Dec 2007
Reputation Points: 10
Solved Threads: 5
 

try refreshing your connection.....ADO ....RDO whatever u r using

dspnhn
Junior Poster in Training
90 posts since May 2008
Reputation Points: 20
Solved Threads: 13
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You