[thelist] asp LOGIC QUESTION
Ian Anderson
ian at zstudio.co.uk
Fri Apr 21 14:19:37 CDT 2006
Matt Warden wrote:
> select *
> from CATEGORY c
> inner join THING t on t.catid = c.catid
> order by c.catname, t.thingname
Perhaps I am missing something, and I suspect I may have misunderstood
the OP's intention, but anyway. How will this give me grouped results like:
Category 1
- foo
- woo
- boo
Category 2
- fee
- snee
- pee
etc?
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
> 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 - which is basically what I had shown. What's the difference then
between this and what I am presently using in these situations?
What am I missing here?
--
zStudio - Web development and accessibility
- http://zStudio.co.uk
Snippetz.net - Your personal, private code library
- http://snippetz.net
More information about the thelist
mailing list