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.
| Author |
Topic |
|
anonymousmofo
Starting Member
2 Posts |
Posted - 2012-03-30 : 06:25:42
|
| I am currently building a website which deals with sales of cars. I need to be able to work out the total revenue of the cars by calculating the total sales * price. However the problem i am having is the Price and total sales are in 2 different tables. The First Table:Cars Table:CarCode, Make, Model, PriceThe second Table:Sales Table:CarID, Month, Year, Total Sales(CarCode and CarID are linked together with a relationship)How can i get the price of one car and multiply it with the total sales figure across the two tables to get the revenue?Any help would be much Appreciated. |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2012-03-30 : 06:41:53
|
| You might want to follow the Ultra-basic links below.How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-30 : 17:32:06
|
| use GROUP BY on carid and take sum() sales amount into a derived table. then join it to other table on related carcode field------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|