473,416 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

how to display repeated rows on top?

Hi,

I want a help in sql server 2005 as mentioned below:

I want to select rows on top from a table which has more repeated values in a column.

For Example:
pEnt_ID ShortName FundID Received Date
---------------------------------------------------------------
58731 M IX A-3 NULL NULL
58729 M IX A-1 4 NULL
58730 M IX A-2 4 NULL
58729 M IX A-1 23772 NULL
58730 M IX A-2 23772 09/08/2010
58729 M IX A-1 4 NULL

I want to display the rows which has maximum repeated value in pEnt_ID column ie. 58729 on top and then so on.

Like this:

pEnt_ID ShortName FundID Received Date
---------------------------------------------------------------
58729 M IX A-1 4 NULL
58729 M IX A-1 4 NULL
58729 M IX A-1 23772 09/07/2010
58730 M IX A-2 4 NULL
58730 M IX A-2 23772 09/08/2010
58731 M IX A-3 NULL NULL

Please provide some query solution.

Thanks,
Rohan
Sep 30 '10 #1
1 1269
ck9663
2,878 Expert 2GB
What if your data look like this:

pEnt_ID ShortName FundID Received Date
-------------------------------------------------------------
58731 M IX A-3 NULL NULL
58732 M IX A-1 4 NULL
58730 M IX A-2 4 NULL
58732 M IX A-1 23772 NULL
58730 M IX A-2 23772 09/08/2010
58732 M IX A-1 4 NULL
58732 M IX A-1 4 NULL
58731 M IX A-3 NULL NULL
58729 M IX A-1 4 NULL
58729 M IX A-1 4 NULL
58729 M IX A-1 4 NULL

How would your result look like?

~~ CK
Oct 1 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: VM | last post by:
After I do DataTable.Select() on my table, how can I display these rows in my datagrid? I cannot use a dataview because these selected rows will be altered. For example, if my query returns 1 row...
1
by: Chris | last post by:
I would like to know how to display data column for a single record contains many fields. Likes the first row shows first 5 fields, 2nd row show next 5 fields, etc... I tried to use datagrid,...
2
by: ameshkin | last post by:
I know this is probably not too hard to do, but how do I display multiple rows of a mysql query/recordset. Im having trouble doing this. I don't just want to display them, but I want to make sure...
3
by: matthewtec | last post by:
This may turn out to be an obvious answer of "DataGrid", but I haven't used that control much and so I wanted to get some thoughts. If I want to display essentially a grid that could be a...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
10
by: obrienkev | last post by:
Hi all, How do I display multiple database rows in the one textBox? The textBox is bound to the Database table and should display 3 database values. However it displays only one. How do I...
1
by: imrannawabkhan | last post by:
I was working on project page where I required to get the row data from mySql db in side the table cells. I knew how to use the php script to get the row data into the table cells like. Id | ...
4
by: Plamen Ratchev | last post by:
What happens when you add the column WQR_TDH_HEADER_ID to both SELECT and GROUP BY? If you get rows you consider non-duplicate show as duplicate, then most likely your grouping does not include all...
3
by: monion | last post by:
Hello, I am trying to retrieve multiple rows from a database, place each row into a form and beside each row add an input field with a variable field name. So far I can only pull one row. If it...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.