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 |
|
hksharmaa
Starting Member
16 Posts |
Posted - 2010-11-23 : 07:08:11
|
| Hello All...I have a Table which contains Fields (Batch No,Quantity and Rate).The Table Consits of 200 records....Now i want to obtain those 40 Batch whose Sum of Quantity/40 lies between 100 to 200kg and Sum of Rate/40 is betwwen 10-15 Rs.The output must consists of 40 records whose qunatity when i total then divide by 40 should lie between 100 to 200kg and rate should be between 10- to 15...Please help... |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-11-23 : 07:10:09
|
| Post some sample data & expected output.PBUH |
 |
|
|
hksharmaa
Starting Member
16 Posts |
Posted - 2010-11-23 : 07:29:26
|
| Lets take an example...I have 16 records in a table...nOW I WANT TO GET 5 Batch No. whose avg. of qty lies in b/w 110-115 and Rate in between 10-15..Here is the data and below there are some possible solutions..Batch Qty RateD-0001 120 13D-0002 105 15D-0003 109 13D-0004 100 16D-0005 110 15D-0006 120 12D-0007 122 12D-0008 125 16D-0009 118 14D-0010 115 10D-0011 123 13D-0012 116 14D-0013 135 16D-0014 121 14D-0015 112 15The System should Return Me the values of this 5 setD-0004 100 16D-0005 110 15D-0010 115 10D-0014 121 14D-0015 112 15Because the avg. comes is 111.6 and 14 ...IInd solution isD-0002 105 15D-0003 109 13D-0006 120 12D-0009 118 14D-0012 116 14Because the avg. comes is 113.6 and 13.6 ... |
 |
|
|
hksharmaa
Starting Member
16 Posts |
Posted - 2010-11-23 : 07:33:23
|
| Please ignore the previous suggestion as the data got merge togetherLets take an example...I have 16 records in a table...nOW I WANT TO GET 5 Batch No. whose avg. of qty lies in b/w 110-115 and Rate in between 10-15..Here is the data and below there are some possible solutions..Batch Qty RateD-0001 120 13D-0002 105 15D-0003 109 13D-0004 100 16D-0005 110 15D-0006 120 12D-0007 122 12D-0008 125 16D-0009 118 14D-0010 115 10D-0011 123 13D-0012 116 14D-0013 135 16D-0014 121 14D-0015 112 15The System should Return Me the values of this 5 setD-0004 100 16D-0005 110 15D-0010 115 10D-0014 121 14D-0015 112 15Because the avg. comes is 111.6 and 14 ...IInd solution isD-0002 105 15D-0003 109 13D-0006 120 12D-0009 118 14D-0012 116 14Because the avg. comes is 113.6 and 13.6 ... |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|