Know 2 & 3.
Unclear how the Group BY query works.
Main Topics
Browse All TopicsHi All,
Here is the situation. I have a table with a few columns, and one that is called CAT. In this column there will be varying amounts of the same numbers that relate to a category.
How would a do a loop that runs through every record and displays the Category Number once.
For example I have 50 rows of records 25 have the category of 1234 and 25 have the category of 7896. How do I get it to show:-
1234
7896
Thanks for the help.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
1) strSQL = "SELECT CAT, field1, field2 FROM tblSomeTable GROUP BY CAT ORDER BY CAT"
2) set objRS=Server.CreateObject(
objRS.Open strSQL, objConnection
3) <table>
<%
do until objRS.EOF
response.write("<tr><td>" & objRS("CAT") & "</td><td>" & objRS("field1") & "</td></tr>")
loop
%>
</table>
Fritz - you can't use GROUP BY and select fields that are not part of the group by clause or have a grouping function wrapped around them.
So
SELECT CAT, field1, field2 FROM tblSomeTable GROUP BY CAT ORDER BY CAT
won't work but
SELECT CAT, MIN(field1), MIN(field2) FROM tblSomeTable GROUP BY CAT ORDER BY CAT
will
Steve
Business Accounts
Answer for Membership
by: fritz_the_blankPosted on 2002-07-05 at 12:06:19ID: 7132738
1) create a SQL select that groups by category
2) open a record set with that SQL select
3) generate a table from the recordset
Fritz the Blank