[thelist] asp LOGIC QUESTION

Matt Warden mwarden at gmail.com
Fri Apr 21 14:27:09 CDT 2006


> > var currentcat = ''
> > loop until end of recordset
> >     if currentcat != recordset.catname then
> >         do whatever you need to do for each category
> >     end if
> >     do whatever you need to do for each thing
> > end loop
>
> I take it this pseudocode is for the middleware, rather than SQL?
>
> This isn't going to give the results above unless you put it in another
> loop

No. See below:

> By joining tables like you suggest I can easily produce
>
> Category 1 foo
> Category 1 woo
> Category 1 boo
> Category 2 fee
> Category 2 snee
> Category 2 pee
>
> but this isn't the desired output

As you said, the desired output is:

Category 1
- foo
- woo
- boo

Category 2
- fee
- snee
- pee

Which is exactly the output above with the category output suppressed
for every record but when the category changes. This is what my
pseudocode is handling. (This is also why it is imperative to order by
category first.)

--
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list