sql commad problem

Reply

Join Date: Jul 2008
Posts: 633
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 43
abu taher's Avatar
abu taher abu taher is offline Offline
Practically a Master Poster

sql commad problem

 
0
  #1
Jul 21st, 2009
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?
I like sword. Attack or Defense.
my web
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 1,214
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 220
vb5prgrmr vb5prgrmr is offline Offline
Nearly a Posting Virtuoso

Re: sql commad problem

 
0
  #2
Jul 21st, 2009
How does it not work?

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



Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 633
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 43
abu taher's Avatar
abu taher abu taher is offline Offline
Practically a Master Poster

Re: sql commad problem

 
0
  #3
Jul 22nd, 2009
another thing. I write like:
"select sum[exam fee] as total , sum[other fee] as total_fee from table1"
it not work
I like sword. Attack or Defense.
my web
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 1,214
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 220
vb5prgrmr vb5prgrmr is offline Offline
Nearly a Posting Virtuoso

Re: sql commad problem

 
0
  #4
Jul 22nd, 2009
Are the fields numeric? If not that could be your problem but without seeing your code who knows.


Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 633
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 43
abu taher's Avatar
abu taher abu taher is offline Offline
Practically a Master Poster

Re: sql commad problem

 
0
  #5
Jul 22nd, 2009
ya that field are numeric.
I like sword. Attack or Defense.
my web
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 62
Reputation: Mbt925 is an unknown quantity at this point 
Solved Threads: 5
Mbt925's Avatar
Mbt925 Mbt925 is offline Offline
Junior Poster in Training

Re: sql commad problem

 
0
  #6
Jul 23rd, 2009
NOTE:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. sum[exam fee] ==> sum([exam fee])
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 633
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 43
abu taher's Avatar
abu taher abu taher is offline Offline
Practically a Master Poster

Re: sql commad problem

 
0
  #7
Jul 23rd, 2009
Originally Posted by Mbt925 View Post
NOTE:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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?
I like sword. Attack or Defense.
my web
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 62
Reputation: Mbt925 is an unknown quantity at this point 
Solved Threads: 5
Mbt925's Avatar
Mbt925 Mbt925 is offline Offline
Junior Poster in Training

Re: sql commad problem

 
0
  #8
Jul 23rd, 2009
Originally Posted by abu taher View Post
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([exam fee]) as total , sum([other fee]) as total_fee from table1"
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 633
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 43
abu taher's Avatar
abu taher abu taher is offline Offline
Practically a Master Poster

Re: sql commad problem

 
0
  #9
Jul 23rd, 2009
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
I like sword. Attack or Defense.
my web
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 62
Reputation: Mbt925 is an unknown quantity at this point 
Solved Threads: 5
Mbt925's Avatar
Mbt925 Mbt925 is offline Offline
Junior Poster in Training

Re: sql commad problem

 
0
  #10
Jul 23rd, 2009
Originally Posted by abu taher View Post
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 715 | Replies: 12
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC