473,383 Members | 1,859 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,383 software developers and data experts.

Duplicate value in ASP. How to group it.

Hi all,
I have a join query in asp (using access) with ouput like this:

Name Grd Math English
Jon 1 7.0 7.5
Jon 2 8.0 7.0
Ana 1 6.5 8.0
Ana 2 6.0 8.5

Is it possible to hide the duplicate name (jon & ana)?
I want the ouput like this:

Name Grd Math English
Jon 1 7.0 7.5
2 8.0 7.0
Ana 1 6.5 8.0
2 6.0 8.5


Thanks,
aaronzz
Mar 19 '07 #1
1 981
jhardman
3,406 Expert 2GB
Hi all,
I have a join query in asp (using access) with ouput like this:

Name Grd Math English
Jon 1 7.0 7.5
Jon 2 8.0 7.0
Ana 1 6.5 8.0
Ana 2 6.0 8.5

Is it possible to hide the duplicate name (jon & ana)?
I want the ouput like this:

Name Grd Math English
Jon 1 7.0 7.5
2 8.0 7.0
Ana 1 6.5 8.0
2 6.0 8.5


Thanks,
aaronzz
Easiest way I have found requires that I state very carefully what I print at each line:
Expand|Select|Wrap|Line Numbers
  1. <table><tr>
  2. <%
  3. for each fld in objRS.fields %>
  4.    <td><%=fld.name%></td>
  5. <%
  6. next %>
  7. </tr>
  8. <tr>
  9. <%
  10. for each fld in objRS.fields %>
  11.    <td><%=fld.value%></td>
  12. <%
  13. next %>
  14. </tr>
  15. <%
  16. lastName = objRS("NAME")
  17. objRS.moveNext
  18. do while not objRS.eof %>
  19.    <tr>
  20.    <%
  21.    for each fld in objRS.fields
  22.       if fld.name = "NAME" AND fld.value = lastName then %>
  23.          <td></td>
  24.       <%
  25.       else %>
  26.          <td><%=fld.value%></td>
  27.       <%
  28.       end if
  29.    next %>
  30.    </tr>
  31.    <%
  32.    lastName = objRS("NAME")
  33.    objRS.moveNext
  34. loop %>
  35. </table>
I can't think of an easier way to do it. First I pull up the name of each field and put them across the top of a table. Then I pull up the first entry (because you will want the first entry to show in its entirety regardless) and display it in the second row of the table. Then i set a variable with the current NAME record before I move to the next. The I do a regular do...loop which posts each line of the database to the table, but each field is checked. If the field name is "NAME" and the value is the same as the previous name, I write a blank table cell, otherwise it prints the value to the table. Then, right before I move to the next record, I update the lastName variable.

Does this help?

Jared
Mar 20 '07 #2

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

Similar topics

7
by: Lowell Kirsh | last post by:
I have a script which I use to find all duplicates of files within a given directory and all its subdirectories. It seems like it's longer than it needs to be but I can't figure out how to shorten...
3
by: andreas.maurer1971 | last post by:
Hi all, since a few years I use the following statement to find duplicate entries in a table: SELECT t1.id, t2.id,... FROM table AS t1 INNER JOIN table AS t2 ON t1.field = t2.field WHERE...
1
by: Brian | last post by:
I'm trying to find a way to search multiple tables for the same record. Say I have 3 tables all with a name column, I need to search all 3 tables and find matching names. Is there an easy way to...
8
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on...
9
by: Tom_F | last post by:
To comp.databases.ms-access -- I just discovered, to my more than mild dismay, that some tables in my Microsoft Access 2003 database have duplicate numbers in the "AutoNumber" field. (Field...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.