Re: How do you like this SQL?

From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Fri, 14 Dec 2012 02:00:48 +0000 (UTC)
Message-ID: <pan.2012.12.14.02.00.47_at_gmail.com>



On Thu, 13 Dec 2012 16:55:26 -0800, John Hurley wrote:

> One of my developers ... part of a very long piece of SQL near the end
> ... lots of inline views ... and this creative piece of code:
>
> (
> SELECT POC.PO_ID, POC.LINE_ITEM_PO, POC.COMMENT_PO, POC.DATE_ADD_COMMENT
> FROM PO_COMMENT POC WHERE (POC.PO_ID,POC.LINE_ITEM_PO,POC.ROW_TIMESTAMP)
> IN (SELECT A.PO_ID,A.LINE_ITEM_PO,MAX(A.ROW_TIMESTAMP)
> FROM PO_COMMENT A WHERE A.TYPE_PO_COMMENT='LE' GROUP BY A.PO_ID,
> A.LINE_ITEM_PO)
> ) T193
>
> Plus of course ... PO_COMMENT is a very big table ...

That SQL deserves unusual and cruel punishment. Cruel above all else.

-- 
Mladen Gogala
The Oracle Whisperer
http://mgogala.byethost5.com
Received on Fri Dec 14 2012 - 03:00:48 CET

Original text of this message