On 17 Dec 2007 in macromedia.dreamweaver.appdev, darrel
wrote:
>> You will get errors if you do not include all the
columns from your
>> SELECT in the GROUP BY. That is the nature of a
GROUP BY. The only
>> columns you need not include in the GROUP BY are
aggregate
>> functions like SUM(), COUNT() etc.
>
> The problem with that, though, is that I have TEXT
fields in the DB
> that then gives me errors (can't group by text fields).
Just grab the straight data set (SELECT ... FROM ... ORDER BY
field1
ASC, field2 ASC). Then use Tom Muck's Simulated Nested Repeat
Region
[1]. Or it's not that hard to program yourself:
DIM showHeader
showHeader = ""
' start of repeat region code goes here
' Now we want to print a header if this is a new type
IF showHeader <> Recordset1.Fields.Item("type").Value
THEN
' Insert a new header here
Response.Write("<h2>Category: " &
Recordset1.Fields.Item("type").Value
& "</h2>" & vbCrLf)
END IF
' Repeat region for dates goes here
showHeader = Recordset1.Fields.Item("type").Value
' End repeat region
The data still looks like:
CatA Date1 whatever
CatA Date2 whatever
CatB Date1 whatever
Basically all the code above is doing is to print the
category only
when it changes.
[1]
http://www.tom-muck.com/extensions/help/simulatednestedregion/
--
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/contact.php