.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Select Top 10 Percent and 20 Percent

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :Sql Server

HI All,

Select Top 10 Percent  and 20 Percent between data how can i get?

please provide me the Query?

Regards, Prasad.

View Complete Post

More Related Resource Links

MDX: Percent Average of Average (Calc Member)

Not sure this makes sense. What I have is an average payment amount which will be sliced by payer. I want to see what is payer1's percent average of the overall average from all payers. I have a calculated member for average payment amount already: CREATE MEMBER CURRENTCUBE.[Measures].[Average Payment Amount] AS CASE WHEN IsEmpty([Measures].[Count]) OR [Measures].[Count] = 0 THEN NULL ELSE ([Measures].[Payment Amount] / [Measures].[Count]) END, FORMAT_STRING = "currency", NON_EMPTY_BEHAVIOR = {[Payment Amount]}, ASSOCIATED_MEASURE_GROUP = 'Payment', VISIBLE = 1   Any help is appreciated. I was thinking I need to do something with currentmember, but then I couldn't think of how I would have the denominator be all payers.  I dunno, hopefully it's easier than I'm making it.

Percent of Total for Each Member in a Dimension Across Another Dimension


I've got a particularly nasty problem that I've been pounding my head against that I hope someone has encountered and can help me with.  I have a hospital cube that has a Hospital dimension and a Service Line Dimension (among others).  Service Lines are such things like General Medical, Surgical, Cardiology (there are 16 total).  Each member hospital in the Hospital dimension will have Discharges associated with each Service Line.  I'm trying to construct a percent of total calculation for each Hospital and Service Line, so I can look at the percent of total of each Service Line across Hospitals.  I'm trying to create a report in SSRS based off this cube.  Here's what the dimensions look like:

Hospital Name1    General Medical
Hospital Name2    General Medical
Hospital Name3    General Medical

What I want to do is calculate the percent of total of each hospital's Service Lines, using the total for each Service Line across hospitals.  This will show the contribution of a Service Line at a specific Hospital to the overall total for that Service Line for all Hospitals.  Here's the MDX I've been working with that does not work the way I want:

Percent of Total Calculation with Mixed Static and Dynamic Groups


Ok, here's one I'm really struggling with.  I have a report that has two dynamic row groups and three dynamic column groups that are nested beneath static column groups.  It looks similar to this:

                                                  Market Share                  Discharges                           LOS

                                                Column Group1               Column Group2               Column Group3

Row Group1  Row Group2       &

Percent format?


Hi all

How do I format my numbers to show % symbol in InfoPath?
For instance show 45 as 45% 

Can't find any option for that :(


Can you please tell me how you tell what percent of the SQL 2005 operations are read and what percen



I have to build a new SQL server and would like to pick the best hardware platform for our new server.   Our old server was RAID 1.   To figure out the best platform for the new server, I would need to know what percent of the time the sql discs are used for read and what percent for write.   I don't know much about SQL other than installing SQL and then adding an application to use SQL.   Forgive me if this is an obvious thing to look up.  FYI we are currently running SQL 2005 on our existing server.

selecting a percent of a table and similar records



I have a piece of sql code that selects the top 10% of a table. See below a sample of the database table


And this is my code

       CONVERT(VARCHAR, (CONVERT(FLOAT, Points)/CONVERT(FLOAT, totalpoints))*100) + '%' PercentPoints   
FROM   (SELECT *,   
               SUM(points) OVER() totalpoints   
            FROM  tests.dbo.tester4)A    
Order by Points desc


So what this code does is add up all the points in the points table, (also works out what percentage of the points each user has) and then displays the top 10%, which in this case will give me "John" and "Dave"

So what I need the  sql to do is check if any other records in that table have the same number of points ast the last selected record, and to select it to.

So in the above table, the code shoud return  "John", "Dave" and "Mark" as Dave and Mark are on the same amount of points.  Does anyone know how I can do this?

Sorry if this is not clear

datatype for percent

what would be the best datatype to use for a column that will contain 0%-100%?

How to calcuate percent change in Infopath


Hi maybe someone out there can help me.  I need to calculate percent change in an InfoPath form services form. 

Using Excel, the formula would be: (NewSalary - OldSalary)/ABS(OldSalary).

Unfortunately, InfoPath 2007 does not seem to offer an ABS function.  I tried using an xpath expression with fn:abs(OldSalary) but no luck.

Thanks in advance for your help,


How to know percent completed?

I'm running WSS 3.0 and I would like to know if it's possible to estimate the percent comped by indexing service.  I'v stared full crawl and it's been running for few days.  I have huge content DB 100G and I'm not sure as to when the index will be completed.  The CPU remains busy all the time and indexing has been running for 2 days straight.  Should I expect CPU to damp off once index is built? My indexing schedule is set to every 10 minutes.

Top N PERCENT function analogue using ranking functions


Hi everybody,

I'm wondering if there is a good way to simulate TOP N PERCENT using RANKING functions? NTILE() comes close, but it doesn't simulate it exactly. It almost looks like we need a new PERCENTILE() ranking function.

Thoughts, ideas?

Thanks in advance.



Premature optimization is the root of all evil in programming. (c) by Donald Knuth

Naomi Nosonovsky, Sr. Programmer-Analyst

My blog

Restore just stalls at 90 percent



I am trying to refresh a dev database from production. 

Both systems are running SQL Server 2008 64 bit with SP2 on Windows Server 2008.

The backup of prod is done with Red Gate's SQL Backup 6.   

The resulting sqb file is copied to the dev server.  Because we don’t have a Red Gate license for the dev server, we use their tool sqb2mtf.exe to recreate the .bak file and then restore using native SQL.

We have done this many times without issue.

However, today the native restore to dev is not working.  It appears to work as the progress info shows 10

AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

Select value in gridview


Hi, I am new to gridview. I want to make a gridview. Its row when selected should direct me to a specific .aspx page.Each row should direct to a different page. Should I use querystrings for this? Please suggest. Regards, ap.

The XML Files: XSLT Keys, Select vs. Match, Conflict Resolution, and More


This month Aaron Skonnard covers how keys work in XSLT, XSLT match and select attributes, SelectNodes order, finding