select sum

1. Junior Member
Join Date
Dec 1969
Posts
4

## select sum

im using this sql statement:<BR><BR>sSQL = "select distinct j_nama, an_acc_code, right(left(an_acc_code, 3),2) " &_ <BR> "from acc_name, jenis_proj where " &_<BR> "an_brn_code = &#039;" & branch_code & "&#039; and " &_<BR> "j_kod = substring (an_prj_code,3,5) and an_acc_level = &#039;3&#039; and " &_<BR> "substring(an_prj_code,3,2) = &#039;20&#039; and " &_<BR> "((an_acc_code = &#039;N4101&#039; and (an_acc_level = 3)) or " &_<BR> "(left(an_acc_code,3) = &#039;K61&#039; and (an_acc_level = &#039;3&#039;)) ) " &_<BR> "order by right(left(an_acc_code, 3),2)"<BR><BR>and<BR><BR>sSQL = "select sum(ar_curCr - ar_curDb) as Isipadu from acc_rec where ar_acc_code = &#039;" & rsPerladangan("an_acc_code") & _<BR> "&#039; and ar_brn_code = &#039;"& branch_code &"&#039; "<BR><BR>and results this table<BR><BR>No &#124Komoditi &#124Bussiness Volume (RM) &#124 <BR>1 &#124Tanaman Buah Nanas &#124 3,603.80 &#124<BR>2 &#124Tanaman Padi &#124 2,464,218.85 &#124<BR>3 &#124Tanaman Padi &#124 93,252.84 &#124<BR><BR>problem: what am i suppose to do to get this results<BR>No &#124Komoditi &#124Bussiness Volume (RM) &#124 <BR>1 &#124Tanaman Buah Nanas &#124 3,603.80 &#124<BR>2 &#124Tanaman Padi &#124(2,464,218.85 + 93,252.84)&#124<BR>thanks<BR><BR><BR><BR><BR>

2. Senior Member
Join Date
Dec 1969
Posts
19,082

## don't repost. there's no need.

3. Junior Member
Join Date
Dec 1969
Posts
4

## RE: don't repost. there's no need.

im reposting it because i didnt tell my problem yet

4. Senior Member
Join Date
Dec 1969
Posts
19,082

## RE: don't repost. there's no need.

what are you, stupid? stick to the original thread<BR>

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## But as Atrax said...

...you need a SUM (aggregate function) in the SELECT and then a GROUP BY.<BR><BR><BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•