January 29, 2009 at 7:47 pm
i´ve litle experience with sql, i´ve this query
select sc.ref,sc.design,sc.qtt,sc.ecustof, (SC.QTT*sc.ecustof), from st inner join sc on sc.refb=st.ref
wich returns this:
ref design qtt ecustof Exp_5
204432 artigo teste 3 100 300
50099 artigo teste2 10 60 600
i need to sum the values from Exp_5 (900) and replace them in onother table st.total
can anyone help me
thanks in advance.
January 29, 2009 at 11:12 pm
Check out the SUM() aggregate function together with the GROUP BY clause of the SELECT statement.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
February 3, 2009 at 12:29 pm
Hi
You can use the sample query
In your case you dont have any critirie to group by so in the below query i removed the group by.
SELECT SUM(EXP_5) from
Thanks -- Vj
February 8, 2009 at 2:37 am
hi,
you can use sum function but also you need to grou by other fileds too,
select f1, f2,sum(f3)
group by f1,f2
February 9, 2009 at 12:35 pm
i need to sum the values from Exp_5 (900) and replace them in onother table st.total
In your onother table, is there ONLY a SINGLE record, which is overwritten with the next sum value each and every time you run the stored procedure ?
February 12, 2009 at 5:18 am
thanks for the help, is working !!!
thank you
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply