Newbie Question - Datagrid Results

K

Keith

Is there a way to display the field you are GROUPING BY in a datagrid? I am doing a select count and using the GROUP BY option to display the results. When the results are displayed in the datagrid it just shows the results but not the field it is being GROUPED BY (probably getting what I am asking for).

Current Results Example

Total
10
5
7
10

I would like to see the name field I am sorting by displayed in the datagrid

Name Total
Allen 10
Beth 5
Carol 7
Tom 10

Any help is appreciated!

Thanks,
Keith
 
G

GregC

Hi Keith,

Just add a select distinct to to your query similiar to :

select distinct name, sum(user_item) as Total from user_items group by
user_item;

Hope this helps!

GregC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,353
Latest member
RogerDoger

Latest Threads

Top