Author |
Topic |
Nasser
Starting Member
12 Posts |
Posted - 2008-04-21 : 04:45:49
|
the database contain table its name is MovementTablethe table contain fileds F01,F02,F03,F04,F05,F06the fileds contain F01=KLMF02=3F03=5F04=6F05=747F06=INDIASELECT f01,f02,f03,f04,f05,f06 ,SUM(f02,f03,f03) as total FROM MovementTable WHERE F01 = KLMI WANT TO HAVE FILED IN REPORTS CONTAIN THE SUM OF F02,F03,F04 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-21 : 04:55:15
|
[code]SELECT f01,f02,f03,f04,f05,f06,(f02+f03+f03) as total FROM MovementTable WHERE F01 = 'KLM'[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
Nasser
Starting Member
12 Posts |
Posted - 2008-04-21 : 05:02:01
|
hello mr harsh_athalyeyou code will give not give me the right answeryour code ,(f02+f03+f03) as total = 356 it should = 14thanks for your help |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-21 : 05:07:19
|
How could simple addition of three fields gives you wrong sum? Post the query you tried.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
Nasser
Starting Member
12 Posts |
Posted - 2008-04-21 : 05:10:55
|
mr harsh_athalyeallow me to tell you that i'm ussing ur code throw VB.net 2003does that make any diffrent ??!!i did tryied same code you give me |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-21 : 05:13:18
|
No, it doesn't make any difference.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
Nasser
Starting Member
12 Posts |
Posted - 2008-04-21 : 05:52:38
|
so how it should fix |
 |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2008-04-21 : 08:26:50
|
(f02+f03+f03)should this be f02+f03+f04) ????what values are in F02, F03 and F04??? |
 |
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-21 : 08:39:45
|
quote: Originally posted by RyanRandall FYI all helpers - F02, F03 and F04 have varchar datatype. This thread is related...http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=101350Ryan Randall Solutions are easy. Understanding the problem, now, that's the hard part.
Wow! So all it really was a concatenation! Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
Nasser
Starting Member
12 Posts |
Posted - 2008-04-21 : 10:40:19
|
thanks for helping me , i found the problem the data type of filed is text , it should be Number so that sql statement work fineSORRY FORM BATHRING YOU |
 |
|
|