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
 Complicated Query Need Some Help

Author  Topic 

waqasaslammeo
Starting Member

1 Post

Posted - 2012-01-19 : 03:49:55
Hello Every one !
i am trying to make query to show the growth of sale of the product month wise ,i have one table name Sales .having following fields , SalesID,ProductID,amt,Qty,SalesDate
i use this query to show my records

SELECT ProductID,Amt,Qty,substring (datename(month,SalesDate ),1,3)AS months,DATENAME(YEAR,salesdate ) AS years
this query shows my records in this way
-------------------------------------------
ProductID*****Amt*****Qty*****months*****years
----------------------------------------------
1****************400********6**********Dec**********2011
2****************300********4**********Jan**********2012
----------------------------------------------
I WANT TO SHOW MY RECORDS IN THIS WAY
-------------------------------------------
ProductID*****Amt*****Per.MonthQty*****Cur.MonthQty*****months*****years
------------------------------------------------------------------------
1****************400**********0****************6*************Dec******2011
2****************300**********6****************4*************Jan******2012
------------------------------------------------------------------------

sorry if you are feeling bad after reading it ,
can any one help me to solve this prob

Regards

M.Waqas Aslam

give best get best

whatamouth
Starting Member

16 Posts

Posted - 2012-01-19 : 08:40:34
Can you define the ff.
-Per.MonthQty
-Cur.MonthQty

Neil Matias
neilmatias@yahoo.com
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-01-19 : 09:01:36
It would be nice to have
- the table structure
- some sample data
- the wanted result
for example like this:



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -