Grouping records with GetString?

Results 1 to 3 of 3

Thread: Grouping records with GetString?

  1. #1
    Join Date
    Dec 1969

    Default Grouping records with GetString?

    Hi all . . .<BR><BR>I created an ASP that queries a SQL database (select * from [whatever] order by [something], etc.), uses GetString to create a table (using "&#060;/td&#062;&#060;td&#062;" as delimiters, etc.), and creating a table that looks something like this:<BR><BR>Category Item Description<BR>-------- ---- -----------<BR>Cat A Item 1 Some descrip.<BR>Cat A Item 2 Some descrip.<BR>Cat A Item 3 Some descrip.<BR>Cat B Item 4 Some descrip.<BR>Cat B Item 5 Some descrip.<BR>Cat B Item 6 Some descrip.<BR><BR>It works nicely, but when you start getting hundreds of records, readability becomes compromised.<BR><BR>What I&#039;d LIKE to do is something like this:<BR><BR>Category: Cat A<BR>Item Description<BR>---- -----------<BR>Item 1 Some descrip.<BR>Item 2 Some descrip.<BR>Item 3 Some descrip.<BR><BR>Category: Cat B<BR>Item Description<BR>---- -----------<BR>Item 4 Some descrip.<BR>Item 5 Some descrip.<BR>Item 6 Some descrip.<BR><BR>Ideally, I&#039;d like to group my records (similar to a GROUP BY clause in SQL). Is there any way to do this using GetString (minimizing the number of calls to create a recordset)? I&#039;m thinking, why do I have to create additional recordsets when all my data is already in one location? (Besides, I have no way of knowing what or how many "categories" may be in the column.)<BR><BR>I *did* get this to work by using GetRows to put it into an array and using good-old-fashioned for-next loops to format the contents, but it is visibly SLOOOOOOW! If there&#039;s a more efficient way to do this, I&#039;d love to hear about it.<BR><BR>Thanks in advance for your help.

  2. #2
    Join Date
    Dec 1969

    Default RE: Grouping records with GetString?

    Well.. Arrays are faster than using the recordset.. But then you also might run into the problem where the array can get too big and not be able to run at all. You might want to try creating 2 arrays.. one for Cat A the other for Cat B... Just some thoughts...<BR><BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default Not with GetString and straight selects

    GetString is dumb, which is one of the things that makes it so fast. It just concats all the recordset fields together. You have to use GetRows, unless...<BR><BR>you use a stored procedure and cursors to manage your output.<BR><BR>I know that Oracle has a cool little utility where it will do a psuedo GROUP By the way you indicate here. I forget the exact syntax, but it had something to do with REPORT.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts