[thelist] way OT -- keyboard woes

rudy r937 at interlog.com
Tue Oct 16 22:23:53 CDT 2001


a couple of the keys on my keyboard have died from overuse

i've pried the caps off to see if there's an accumulation of grunge under
them, but that's not the problem, and it looks like there's a rubber
thingie under the cap, so maybe the electrical contact is grungy under
that?  i don't want to pry the rubber thingie up, in case i rip it, but
before i take the keyboard apart from the bottom, perhaps someone can
advise whether i should even bother -- have i just pounded the key to
death, or can it be fixed?   by me?


<tip type="sql">

want to display a total line as well as detail records from your database?
don't do it in your server script (asp, php, cold fusion, whatever) because
hey, life's too short to code needlessly, and even if you write real nice
tight code, the database can always do it faster and more reliably...

   select "detail line:"
        , col1
        , col2
        , (col1 + col2) as rowsum
     from yourTable
union all
   select "total line:"
        , sum(col1)
        , sum(col2)
        , sum(col1) + sum(col2)
     from yourTable
order by 1, 2

the entire result set (from both subqueries) is sequenced by the first and
second columns -- the "detail/total" literal, and then the value of col1

it is a convenient coincidence that "detail line:" sorts ahead of "total
line:"

also, note once again that it's "union all" instead of just union, since
you know there will never be any duplicate rows generated by the two
subqueries, so the sort to detect dupes is not necessary

if you're accessing mysql, you may need to issue two queries -- slightly
slower, and perhaps you'll then want to program the buckets yourself, but
you must resist the temptation, because it is far far less upwardly
compatible that way...  mysql plans to support union some day...

</tip>


rudy






More information about the thelist mailing list