France Fixes Parking Problem

Parking can be a problem.  How can you get more cars into a limited amount of space?

french_parking

Well, France has a novel approach. Stackable cars.

Why not?  We have stackable washing machines, stackable wine glasses, stackable drawers, and of course stackable furniture.  The next step is obviously stackable cars.

The world has a limitless number of stackable, aka Jenga-like things.

So if you want to find more stackable items, check out this website:

Thanks to Anne-Christine Poujoulat, AFP/Getty Images

What Is The Really Big Problem Facing The US?

Is it Big Banks or Big Government?

the_biggest_problem

Can you decide?

Can you do anything about either?

Yes you can.

You can vote for a constitutional amendment to reestablish campaign financing limits.  No one should be able to buy Congressional votes.  Then we will have our democracy back.

Then we the People, not the Rich, can control the size of Government and the size of Banks.

Don’t you want control?  Sure you do.

PS  Citigroup just moved its headquarters into the Capitol building with offices next to Congress.  Thus the drawing above is more accurate than we thought.  Oops.

Engineers Make Lousy Husbands

An engineer is trained to think about all the possibilities for a system problem.  Whether it is a hardware or software system, all the reasons for a hiccup or failure must be identified in order to resolve the problem.  This results in several hypotheses and explanations.

rock_climber

While engineers may be great problem solvers, they fail to get a grip on how to communicate.

When an engineer tackles one of life’s problems, many possible solutions are examined.  Like which do you do first – pay the bills, buy groceries or fix the garden?  And in what order do you perform the rest of these tasks?  An engineer would give several action plans and reasons for each.

But a wife thinks a lot differently than an engineer.  In fact a woman will want one and only one answer to a question or issue or she will begin to distrust the husband.

So try to imagine being an engineer AND a husband.  What a conundrum.

She gets upset when he gives her more than one answer and then he gets frustrated when he realizes he should have stuck with the first answer.  Talk about being up the creek without a paddle.  Oy vey!

Sybase SQL Challenge – Sum Of Max Values

--------DATA in Cat_Tbl---------------------------
Cat1           Cat2          Value
a              e1            113
b              e1            14
a              e2            15
c              e3            13
a              e1            13
a              e2            11
c              e4            1

Sybase

PROBLEM:

For each distinct value in Cat1, user wants to find maximum of Values grouped by Cat2 and then sum them up. 

 

 

Step 1: User wants to extract the following rows for example where Cat1 = ‘a’.

Cat1 Cat2 Value 
a    e1   113 
a    e2   15 
a    e1   13 
a    e2   11

Step 2: User wants to extract maximum corresponding to Cat1 and Cat2:

Cat1 Cat2 Value 
a    e1   113 
a    e2   15

Step 3: User wants to sum the Values for Cat1.

Cat1 SumOfValueColumn 
a    128 
b    14 
c    14

stackoverflow

 

 

 

 

SOLUTION 1 USING TEMPORARY TABLE #Max_Cat_Tbl

select Cat1, Cat2, max(Value) Maxvalue 
into #Max_Cat_Tbl from Cat_Tbl 
group by Cat1, Cat2 order by 1, 2 
select Cat1, sum(Maxvalue) 
from #Max_Cat_Tbl 
group by Cat1 
order by Cat1 
drop table #Max_Cat_Tbl 
go

SOLUTION 2 USING VIEW Max_Cat_Tbl_View

create view Max_Cat_Tbl_View 
( Cat1, Cat2, Maxvalue ) as 
select Cat1, Cat2, max(Value) 
from Cat_Tbl 
group by Cat1, Cat2 
select Cat1, sum(Maxvalue) 
from Max_Cat_Tbl_View 
group by Cat1 
order by Cat1 
go

Good SQL, good night.