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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Getting multiple counts ordered by Groups with a TOP X thrown in as well!

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

Hi, I have a result set (it's from multiple tables), that outputs the following values thus:

Department Statement Rating

IT Factor X 5

IT Factor Y 4

IT Factor X 3

SALES Factor Y 5

IT Factor X 4


Now, what I want to get out of this is a dataset detailing per department which had the highest number of records for a given statement (e.g. factor x) with the avergage.  However I don;t want to output all of them, just the highest.


So, the output would be something like:

Department Top Statement TotalCount  AvgRating

IT Factor X 3 4

SALES Factor Y 

View Complete Post

More Related Resource Links

Multiple groups of roles in membership

Hi,I am developing this website which requires multiple groups of roles inside membership.Here is an example:I want to create a group of states (would be the first group of roles):* Oregon* California* Kansas* Texas* OhioAnd then a second group of profiles:* Admin* Section 1* Section 2* Section 3Then I want to comine these groups, so for example:* Patrick has Oregon and Section 1 role, so he can only access the state of Oregon and Section 1 module on the website.* Laura has Kansas and Section 2 role, so she can only access the state of Kansas and Section 2 module on the website.* John has Ohio, Texas and Admin and Section 1 roles, so he can only....Do you understand what I mean? How can I achieve this with .net memberhip?

A tsql report with multiple counts and pivioted description attributes

Hello,   I have an assignment in which I am to prepare a report displayed in excel to return counts of various attributes in the database. However, the count is a bit challenging because it requires counting certain attributes in a pivot format illustrated below. The counts for each category by recruiter, rolled up by Division, within the specified time frame.   The tables that I would have to deal with are as follows:   User: Has the number of Accounts…user accounts with no Recruiter are unassigned Recruiter: Has the recruiter information LoginHistory: Has a record of all logins EForm: Has the various forms, for example: Release and Authorization, Provider Service Agreement EFormUserXref: You can filter it to return the Physican AppForms                                                                       Surgery                                      &n

Need multiple distinct counts, have 1 fact and 1 dimension

I am using SSAS 2005. I have 1 fact table and 1 dimension. I would like to create multiple distinct counts in 1 Measure group, at least I would like them to appear as in 1 measure group to end-user. I have tried role-playing dimensions, and a roll your own approach that work in limitation but didn't scale. Any help and advice would be great.

Parsing Words from Multiple Recordsets - Returning With Word Counts


I've had too many sleepless nights trying to work this out - I hope I can get some help here.

I have three distinct ADO recordsets that I need to parse words from and return to the client with sorted full word counts (less a predefined dictionary of innocuous words e.g. a, an, the, of.) across all three, references to the original record and references to the original source. The user needs to be able to drill in and out of this result set.

I'm going to simplify the layout for clarification purposes.

Let's say each data source has three identical fields 'updatedTime' (DateTime), 'text'(VARCHAR(255)) and 'ID'.

User goes to the site and searches for the word 'frog'.
User is returned with a word count of every record that has the word 'frog' in the 'text' field sorted by the top count down.
'green' 18 times in table A, 12 times in table B, 22 times in table C
'hop' 16 times in table A, 13 times in table B, 6 times in table C.
'roadkill' 12, 11, 4
'red' 10, 12, 3
And so on.

User clicks on the word 'green'.
Now only words with both 'frog' AND 'green' in the original record show up (again, with the counts and sorted by count).
A breadcrumb is built, so the user can click on 'frog' again to kill that filter.
User decides he doesn't want the default timeframe (6 months) and adjusts a filter

C# ListView groups and subItems. Multiple rows? SubItems as 2d array?


I am attempting to have multiple rows in one column associated with 1 ListViewItem.

I am pulling the data from an XML file with XQuery.  I am able to iterate over the multiple elements using:

listItem.Group = listView1.Groups["phone"];

var g = q.Elements("phone");//data pulled from query

 foreach( var p in g )


string phone_num = p.Value;




I have also tried:

 listItem.SubItems.Add(new ListViewItem.ListViewSubItem(listItem, phone_num));


I am attempting output similar to:


Client                Phone #      ColumnN     


John Smith        123-4567       blahN

                        234-5677         -

Jane Smith        345-6787      blahN

Thanks in advance for any help.

Assign sharepoint workflow task to multiple users/groups




I need to assign workflow task to multiple users or groups based on the user department in the active directory. I am trying to use the AssignedTo property of the SPWorkflowTaskProperty to achieve this but don't know how. I tried to put multiple user ids in the sting separated by ";", but this is not working.


Any suggestions are appreciated.

multiple groups of info in the same program



I have a program (Win App) and i need to display different groups of information at different times, that the user can switch though at will. I decided to implement a menu bar with diferent buttons that will show or hide the different panels of information when necessary (the "Stats" button will hide all the panels but the "Stats" one which it shows). i was wondering whether to use different groups, or simply different forms or something simillar. The catch is that I have some information that needs to be shown always, and other information that appears on different parts of the window, depending on which of the two panels it appears on is open. there are about 4 different panels in the program.

Thank You in Advance!


(and sorry if this is in the wrong forum, i seem to have a knack for that!)

Search DB, Multiple File Groups & Sizing Guidelines?



The following two articles cover the use of a second file group for the Search database however there's no indication of sizing. Are there any guidelines on how large each file group will end-up?

For example, if my Search database is 100GB and I split this out into two file groups will each file group end-up as 50GB each, 60GB in one, 40GB in another, etc...any ideas?





DirectorySearcher Filter Options - Multiple Groups in one Filter


Hi I'm looping through groups and displaying the user belonging to each group and I've just started working with the filter to exclude all groups except the one I specify in the filter like so:

Dim mySearcher As DirectorySearcher = New DirectorySearcher(eSecurity)
mySearcher.Filter = "(&(objectClass=user)(objectCategory=person)(memberof=CN=myGroupNameHere,OU=myOU,DC=myDC,DC=myDC))"

Is there a way I can extend the filter to select a number of groups like so:

mySearcher.Filter = "(&(objectClass=user)(objectCategory=person)(memberof=CN=myGroupNameHere,OU=myOU,DC=myDC,DC=myDC)(memberof=CN=myGroup2Here,OU=myOU,DC=myDC,DC=myDC))"

I've tried a few different arrangements of code, but haven't been successful yet. Does anyone know how or if I can use the filter in this way?

Hope you guys can help me out. I've found the information here indispensable!!

Issue with Report Model on a Cube (multiple measure groups)


Hi All, 

I have was asked to built a report model on the cube for some users and being new to report builder 3.0. 

I am having a weird issue. Lets Say I have following DIMS and FACTS. I have a cube built on top this Dimensional model. 

Two measure Groups/mearsures  : ClassFact/ClassHours and FacilitatorFact/FacilitatorHours.

used Many to Many relationship for FacilitatorDIM and ClassFact measuregoup. I now browse the cube it works excellent. 

The problem Starts

Now a report model is built on top of it, then in the query wizard when I pull both groups and then FName the Classhours(measure) Disappears. 

Does Report Modes supports Many to Many or am I missing something? Any help will be appreciated. 




ClassDIM (ClassID, ClassName) 

FacilitatorDIM ( FID, FName) 


ClassFact( ClassID, Classhours) 

FacilitatorFACT(FID, ClassID, FacilitatorHours)


Sample Data: 



SELECT     ClassID = 1 , ClassDurationHours = 100.0

FROM       ClassFact


SELECT     ClassID = 2 , ClassDurationHour

Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Binding the multiple drop down boxes in GridView using JQuery in ASP.NET

Here is the code for binding the multiple drop down boxes in GridView using JQuery in ASP.NET

Upload Multiple File using JQuery in asp.net

In this article I have explained how to upload multiple files using file upload control. I have used jQuery plugin for uploading multiple files.

I have also explained how to check for file type, file maximum size limit using jQuery & also using server side validation code.

RadioButton Groups, Table Rows And NamingContainers in asp.net

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

RadioButton Groups, Table Rows And NamingContainers

(In which AJAX-enhanced CheckBoxes become more useful than RadioButtons but inheritance saves the day, and a simple RadioButton-derived control establishes the purpose of a control's naming container)

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

GridView Multiple Filter AJAX Control

This AJAX control enables the user to filter data within any column inside a GridView. The user can add multiple filters and can delete existing ones too.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend