[thelist] SQL Query : using Group By and Order By together
Joel Lieberman
joel_lieberman at yahoo.com
Sat Jan 5 16:22:53 CST 2002
You're correct about needing the "type" in the order
by clause (Doh!!) Also, turnips and carrots aren't
really animals either <g>
I have been actively using the PL/SQL environment
params (like BREAK ON) to set up all kinds of nicely
indented web-based data displays. You don't even need
to bother about it because the content is pre-massaged
before being delivered to the browser <TD> sets. In
fact, you could say that SQL isn't even involved -
just the PL/SQL environment declarations.
I can't publish the stuff to show you for
confidentiality reasons, but if you want to contact me
at joel_lieberman at yahoo.com I can explain a little
further.
Thanks again dudes -
This is a really great group of energetic people!
Best - Joel
--- rudy <r937 at interlog.com> wrote:
> > Stop me if I am off topic.
>
> web content management using a database is on topic
>
>
> >Animal
> > cat
> > dog
> >vegetable
> > carrot
> > turnip
> >
> >where the query is something like
> >
> >Select type, animal
> >from my_table
> >order by animal;
>
> surely it's
>
> order by type, animal
>
> otherwise, carrot would come first
>
> ;o)
>
> in my opinion, the creation of break or total lines
> is probably best done
> in the web page script, rather than in sql
>
> that's not to say you can't do it -- see
>
<http://searchdatabase.techtarget.com/ateQuestionNResponse/0,289625,sid13_c
> id424565_tax285649,00.html> for an example of
> generating total rows using
> GROUP BY and UNION ALL
>
> however, where the break or total rows are
> intermingled with the detail
> rows in the result set, it seems to me you'd still
> want to do some logic in
> the web page script in order to display them
> differently -- for example, to
> indent the animals under the type
>
> so even though pl/sql and transact/sql can do break
> processing on the
> database, you still have the problem of those
> intermingled rows having to
> fit the same result set columns, which can get messy
> if there are any
> numeric columns, so you probably have to have logic
> in the web page script
> to handle that anyway, and then you might as well do
> the break processing
> there too
>
> (right now there are a couple guys going "wha?? rudy
> suggested *not* doing
> something in the database??!!")
>
> cold fusion's CFOUTPUT GROUP parameter provides a
> really elegant way of
> handling breaks --
>
> <cfoutput query="joel" group="type">
> #type#
> <cfoutput>
> #animal#
> </cfoutput>
> </cfoutput>
>
>
> > Let me know if you want me to continue.
>
> yes, but please trim your replies ;o)
>
>
> rudy
>
>
>
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
More information about the thelist
mailing list