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:
-
<table><tr>
-
<%
-
for each fld in objRS.fields %>
-
<td><%=fld.name%></td>
-
<%
-
next %>
-
</tr>
-
<tr>
-
<%
-
for each fld in objRS.fields %>
-
<td><%=fld.value%></td>
-
<%
-
next %>
-
</tr>
-
<%
-
lastName = objRS("NAME")
-
objRS.moveNext
-
do while not objRS.eof %>
-
<tr>
-
<%
-
for each fld in objRS.fields
-
if fld.name = "NAME" AND fld.value = lastName then %>
-
<td></td>
-
<%
-
else %>
-
<td><%=fld.value%></td>
-
<%
-
end if
-
next %>
-
</tr>
-
<%
-
lastName = objRS("NAME")
-
objRS.moveNext
-
loop %>
-
</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