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 |
IEyeScream
Starting Member
6 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-22 : 06:17:53
|
just add Product.CurrentPrice field also in the select list------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
IEyeScream
Starting Member
6 Posts |
Posted - 2013-05-22 : 06:26:27
|
but my currentprice is in a different table. and i want to include it in. |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-05-22 : 06:45:44
|
SELECT Product.ProdName,Category.CategoryCode, sp.CurrentPriceFROM Product INNER JOIN Category ON Product.ProdCode = Category.CategoryCodeINNER JOIN SetPrice sp ON sp.ProdCode = Product.ProdCode--Chandu |
|
|
IEyeScream
Starting Member
6 Posts |
Posted - 2013-05-22 : 19:26:01
|
Total sales per order date.What Query should i use for this.? sales is not in my tables..https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-frc3/261607_4470109405442_2069214335_n.jpgquote: Originally posted by bandi SELECT Product.ProdName,Category.CategoryCode, sp.CurrentPriceFROM Product INNER JOIN Category ON Product.ProdCode = Category.CategoryCodeINNER JOIN SetPrice sp ON sp.ProdCode = Product.ProdCode--Chandu
|
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-23 : 00:42:57
|
Group on OrderDate field and apply SUM over sales field (either directly or calculate using qty * price etc)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-05-24 : 03:27:21
|
quote: Originally posted by IEyeScream Total sales per order date.What Query should i use for this.? sales is not in my tables..https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-frc3/261607_4470109405442_2069214335_n.jpg
SELECT O.OrderDate, SUM(sp.CurrentPrice*Od.Quantity) TotalSalesPerDateFROM Order OINNER JOIN OrderDetails OD ON OD.OrderCode = O.OrderCodeINNER JOIN SetPrice sp ON sp.SetPriceCode = PD.SetPriceCodeWHERE IsCurrent = true -- true value based on your datatype. GROUP BY O.OrderDate--Chandu |
|
|
|
|
|