Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 multiple tables

Author  Topic 

confusedintern
Starting Member

1 Post

Posted - 2007-06-06 : 16:35:02
Hi, I had someone help me refine results to show results that have data that match 2 tables. I then created a column of values from the two tables but how do i take the average of that column?

my original script looks something like this:

select a.day, a.time, a.cname, sum(T_GS), sum(T_CS), sum(T_CS)/sum(T_GS) Cost,
sum(T_OPEX), sum(T_CS)/10/sum(T_OPEX) PERCENT from Fs_b12 a, Fs_b7 b

where a.day=2005 and b.day=2005 and a.time=b.time and a.carrier_name=b.carrier_name group by a.day, a.time, a.cname
order by a.cname, a.time

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-06 : 21:43:18
use AVG() ?


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-07 : 10:08:46
or post some sample data with expected result

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -