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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Sql statement help

Author  Topic 

germaism
Starting Member

1 Post

Posted - 2011-08-15 : 21:41:49
I have an invoice table that has invoice#, Soldamount, Paidamount, Solddate, Paiddate, List, and Publication. I am a beginner at sql and cannot figure out how to count the pieces paid and keep the pieces sold accurate. I need to see the Paid Dollar Percentage in one column, and the Pieces Paid Percentage in another column.

For example I have 2 publications, 2 list types. Here is the output im looking for.

Date Pub List TotalSold TotalPaid Dollar% PiecesSold PiecesPaid Piece%
8/7/11 PBCA 1 $1000 $500 50% 100 20 20%
8/7/11 PBCA 2 $500 $200 40% 40 20 50%
8/7/11 ORLT 1 $800 $400 20% 80 40 50%
8/7/11 ORLT 2 $200 $50 25% 300 100 33%

I am new to this forum so im not sure if this will hold its format. Sorry if it appears sloppy once its posted. Also, thanks in advance for any help

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-08-15 : 21:45:26
Firstly, please take a look here http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -