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
 Development Tools
 Reporting Services Development
 Problem in selecting last 3 records based on Item

Author  Topic 

abhit_kumar
Posting Yak Master

147 Posts

Posted - 2010-01-27 : 07:55:45
Hello Friends,

I have made a report which is working correct, but im facing problem in below scenarios.

currently my the below output is coming correct,

PO No Item Details Quantity Rate GRPO No Date Quantity Rate
615 Item A 19 36.07 11 02/07/2009 25 39.78
615 Item A 19 36.07 22 17/09/2009 50 18.3
615 Item A 19 36.07 33 17/09/2009 50 18.3
615 Item B 19 36.07 44 25/11/2009 25 18.3
615 Item B 60 46.66 55 02/07/2009 5 47.59
615 Item B 60 46.66 66 17/09/2009 10 47.59
620 Item A 19 36.07 33 02/07/2009 25 39.78
620 Item A 19 36.07 44 17/09/2009 50 18.3
620 Item A 19 36.07 55 17/09/2009 50 18.3
620 Item B 19 36.07 11 25/11/2009 25 18.3
620 Item B 60 46.66 66 02/07/2009 5 47.59
620 Item B 60 46.66 77 17/09/2009 10 47.59

but i am facing problem in GRPO NO, i want to retrieve last
3 GRPO Nos only, currently its displaying all the GRPO Nos which is incorrect.

Please note as per Item Details i have fetched GRPO NO,
so as per ITEM A,,,there are N numbers of GRPO no, but i want to last entered 3 GRPO NO.

Please look it and guide me.

Thanks,
Avi

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-27 : 08:00:31
is it based on date?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

abhit_kumar
Posting Yak Master

147 Posts

Posted - 2010-01-27 : 08:19:36
Its based upon the Item details not upon date, please see the output above.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-27 : 08:22:56
Post expected output

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-27 : 08:25:46
I think you need this
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/09/12/return-top-n-rows.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -