 |
|
 |
|
Next: *|* Quick Downloads Fast Beautiful Ladies7v19
|
| Author |
Message |
External

Since: Apr 09, 2008 Posts: 576
|
(Msg. 1) Posted: Mon Feb 09, 2009 7:21 am
Post subject: The Query From Hell Archived from groups: comp>databases>oracle>server (more info?)
|
|
|
Hi,
Well, I just thought I'd share this junk with everyone. We hired a
consulting firm to assist on a project. And, well, this is one of the
queries they came up with, which we intend to re-write, once we figure
out what the hell it is doing......
if($compareType=='c') {
$inQuery="'".$strTicker1."', '".$strTicker2."', '".$strTicker3."',
'".$strTicker4."', '".$strTicker5."'";
$getQuery="
select my_left_table.fund_name,
my_left_table.LINK,
DECODE(fund_rank.curr_rank,NULL,'N/A',fund_rank.curr_rank)
AS fund_rank,
my_left_table.nav,
my_left_table.TOTAL_RETURN_1YR,
my_left_table.EXPENSE_RATIO,
my_left_table.MARKET_VALUE_AVG,
my_left_table.MGR_START_DATE
from (
SELECT MUTUAL_FUND.FUND_NAME,
MUTUAL_FUND.TICKER,
to_char( decode( FUND_DAILY_PRICES.NAV,to_char
(-9999),'N/A',FUND_DAILY_PRICES.NAV ) ) AS NAV,
to_char( decode( FUND_MASTER.TOTAL_RETURN_1YR,to_char
(-9999),'N/A',FUND_MASTER.TOTAL_RETURN_1YR ) ) AS TOTAL_RETURN_1YR,
to_char( decode( FUND_MASTER.EXPENSE_RATIO,to_char
(-9999),'N/A',FUND_MASTER.EXPENSE_RATIO ) ) AS EXPENSE_RATIO,
to_char( decode( FUND_MASTER.MARKET_VALUE_AVG,to_char
(-9999),'N/A',FUND_MASTER.MARKET_VALUE_AVG ) ) AS MARKET_VALUE_AVG,
CASE WHEN fund_master.mgr_start_date IS NULL THEN NULL
ELSE TO_DATE( TO_CHAR( '01' || '/'||fund_master.mgr_start_date),'dd-mm-
RRRR' ) END AS MGR_START_DATE,
('<a href=\"http://www.zacks.com/funds/mfrank/quotes.php?
t='||MUTUAL_FUND.TICKER||'&type=main\">'||MUTUAL_FUND.TICKER||'</a>')
AS LINK
FROM MUTUAL_FUND, FUND_MASTER, FUND_DAILY_PRICES
where MUTUAL_FUND.TICKER = FUND_DAILY_PRICES.TICKER
AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID
AND MUTUAL_FUND.TICKER IN( ".$inQuery." ))
my_left_table left join fund_rank
on my_left_table.ticker = fund_rank.ticker";
} else {
// Ashis : "$getQuery" problem in to_date(to_char('01' ||
'-'||FUND_MASTER.MGR_START_DATE),'dd-mm-RRRR') function. when
FUND_MASTER.MGR_START_DATE value is blank then query not execute. This
causes we are added NVL function.
$getQuery="
select my_left_table.fund_name,
my_left_table.LINK,
DECODE(fund_rank.curr_rank,NULL,'N/A',fund_rank.curr_rank)
AS fund_rank,
my_left_table.nav,
my_left_table.TOTAL_RETURN_1YR,
my_left_table.EXPENSE_RATIO,
my_left_table.MARKET_VALUE_AVG,
my_left_table.MGR_START_DATE
from (
SELECT MUTUAL_FUND.FUND_NAME,
MUTUAL_FUND.TICKER,
to_char( decode( FUND_DAILY_PRICES.NAV,to_char
(-9999),'N/A',FUND_DAILY_PRICES.NAV ) ) AS NAV,
to_char( decode( FUND_MASTER.TOTAL_RETURN_1YR,to_char
(-9999),'N/A',FUND_MASTER.TOTAL_RETURN_1YR ) ) AS TOTAL_RETURN_1YR,
to_char( decode( FUND_MASTER.EXPENSE_RATIO,to_char
(-9999),'N/A',FUND_MASTER.EXPENSE_RATIO ) ) AS EXPENSE_RATIO,
to_char( decode( FUND_MASTER.MARKET_VALUE_AVG,to_char
(-9999),'N/A',FUND_MASTER.MARKET_VALUE_AVG ) ) AS MARKET_VALUE_AVG,
CASE WHEN fund_master.mgr_start_date IS NULL THEN NULL
ELSE TO_DATE( TO_CHAR( '01' || '/'||fund_master.mgr_start_date),'dd-mm-
RRRR' ) END AS MGR_START_DATE,
('<a href=\"http://www.zacks.com/funds/mfrank/
quotes.php?t='||MUTUAL_FUND.TICKER||'&type=main\">'||
MUTUAL_FUND.TICKER||'</a>') AS LINK
FROM MUTUAL_FUND,
FUND_MASTER,
FUND_DAILY_PRICES
where MUTUAL_FUND.TICKER = FUND_DAILY_PRICES.TICKER
AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID
AND MUTUAL_FUND.TICKER = '".$strTicker1."')
my_left_table left join fund_rank
on my_left_table.ticker = fund_rank.ticker
UNION ALL
SELECT FUND_NAME,
('<a href=\"http://www.zacks.com/funds/mfrank/quotes.php?
t='||TICKER||'&type=main\">'||TICKER||'</a>'),
DECODE(CURR_RANK,NULL,'N/A',CURR_RANK) AS fund,
to_char(NAV),
to_char(TOTAL_RETURN_1YR),
to_char(EXPENSE_RATIO),
to_char(MARKET_VALUE_AVG),
m
FROM (
SELECT YTD_TICKERS.*,
FUND_MASTER.TOTAL_RETURN_YTD,
row_number() over( order by
FUND_MASTER.TOTAL_RETURN_YTD desc ) as ytd_desc
FROM (
SELECT a.*,
row_number() over( order by to_date(m,'dd-mm-RRRR') )
as m_Asc
from (
SELECT MGR_TICKERS.*,
to_date(to_char('01' || '-'||NVL
(FUND_MASTER.MGR_START_DATE, '05/08')),'dd-mm-RRRR') as m
FROM (
SELECT *
FROM (
SELECT MUTUAL_FUND.FUND_NAME,
MUTUAL_FUND.TICKER,
FUND_RANK.CURR_RANK,
decode(FUND_DAILY_PRICES.NAV,to_char(-9999),'N/
A',FUND_DAILY_PRICES.NAV) AS
NAV,
decode(FUND_MASTER.MARKET_VALUE_AVG,to_char(-9999),'N/
A',FUND_MASTER.MARKET_VALUE_AVG) AS
MARKET_VALUE_AVG,
decode(FUND_MASTER.TOTAL_RETURN_1MT,to_char(-9999),'N/
A',FUND_MASTER.TOTAL_RETURN_1MT) AS TOTAL_RETURN_1MT,
decode(FUND_MASTER.TOTAL_RETURN_3MT,to_char
(-9999),'N/A',FUND_MASTER.TOTAL_RETURN_3MT) AS TOTAL_RETURN_3MT,
decode(FUND_MASTER.TOTAL_RETURN_1YR,to_char
(-9999),'N/A',FUND_MASTER.TOTAL_RETURN_1YR) AS TOTAL_RETURN_1YR,
decode(FUND_MASTER.TOTAL_RETURN_3YR,to_char
(-9999),'N/A',FUND_MASTER.TOTAL_RETURN_3YR) AS TOTAL_RETURN_3YR,
decode(FUND_MASTER.TOTAL_RETURN_5YR,to_char
(-9999),'N/A',FUND_MASTER.TOTAL_RETURN_5YR) AS TOTAL_RETURN_5YR,
decode(FUND_MASTER.TOTAL_RETURN_10YR,to_char
(-9999),'N/A',FUND_MASTER.TOTAL_RETURN_10YR) AS TOTAL_RETURN_10YR,
decode(FUND_MASTER.STD_DEV_3YR,to_char
(-9999),'N/A',FUND_MASTER.STD_DEV_3YR) AS STD_DEV_3YR,
decode(FUND_MASTER.SHARPE_3YR,to_char
(-9999),'N/A',FUND_MASTER.SHARPE_3YR) AS SHARPE_3YR,
decode(FUND_MASTER.R_SQUARE_3YR,to_char
(-9999),'N/A',FUND_MASTER.R_SQUARE_3YR) AS R_SQUARE_3YR,
decode(FUND_MASTER.BETA_3YR,to_char(-9999),'N/
A',FUND_MASTER.BETA_3YR) AS BETA_3YR,
decode(FUND_MASTER.ALPHA_3YR,to_char(-9999),'N/
A',FUND_MASTER.ALPHA_3YR) AS ALPHA_3YR,
decode(FUND_MASTER.FEE_12B1_PERC,to_char
(-9999),'N/A',FUND_MASTER.FEE_12B1_PERC) AS FEE_12B1_PERC,
decode(FUND_MASTER.MIN_INIT_INVEST,to_char
(-9999),'N/A',FUND_MASTER.MIN_INIT_INVEST) AS MIN_INIT_INVEST,
decode(FUND_MASTER.MIN_SUBS_INVEST,to_char
(-9999),'N/A',FUND_MASTER.MIN_SUBS_INVEST) AS MIN_SUBS_INVEST,
decode(FUND_MASTER.PORTFOLIO_TURNOVER,to_char
(-9999),'N/A',FUND_MASTER.PORTFOLIO_TURNOVER) AS PORTFOLIO_TURNOVER ,
decode(FUND_MASTER.LARGE_GROWTH,to_char
(-9999),'N/A',FUND_MASTER.LARGE_GROWTH) AS LARGE_GROWTH,
decode(FUND_MASTER.LARGE_VALUE,to_char
(-9999),'N/A',FUND_MASTER.LARGE_VALUE) AS LARGE_VALUE,
decode(FUND_MASTER.SMALL_GROWTH,to_char
(-9999),'N/A',FUND_MASTER.SMALL_GROWTH) AS SMALL_GROWTH,
decode(FUND_MASTER.SMALL_VALUE,to_char
(-9999),'N/A',FUND_MASTER.SMALL_VALUE) AS SMALL_VALUE,
FUND_MASTER.EXPENSE_RATIO,
row_number() over(order by EXPENSE_RATIO) as
r_exp
FROM MUTUAL_FUND,
FUND_MASTER,
FUND_RANK,
FUND_DAILY_PRICES
WHERE FUND_RANK.CURR_RANK in ".$rank."
AND FUND_MASTER.OBJ_DESCR = '".$arrgetcat[0][0]."'
AND MUTUAL_FUND.TICKER = FUND_RANK.TICKER
AND MUTUAL_FUND.TICKER = FUND_DAILY_PRICES.TICKER
AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID
AND FUND_MASTER.MGR_START_DATE <> '-9999'
AND FUND_MASTER.EXPENSE_RATIO <> -9999
AND MUTUAL_FUND.TICKER <> '".$strTicker1."')
EXP_TICKERS
WHERE r_exp <= 20) MGR_TICKERS,
MUTUAL_FUND,
FUND_MASTER
WHERE MGR_TICKERS.TICKER = MUTUAL_FUND.TICKER
AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID) a)
YTD_TICKERS,
MUTUAL_FUND,
FUND_MASTER
WHERE YTD_TICKERS.TICKER = MUTUAL_FUND.TICKER
AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID
AND m_asc <= 10) top4tickers
WHERE ytd_desc <= 4"; >> Stay informed about: The Query From Hell |
|
| Back to top |
|
 |  |
External

Since: Jun 19, 2008 Posts: 4
|
(Msg. 2) Posted: Mon Feb 09, 2009 1:11 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Feb 9, 3:01 pm, Madison Pruet wrote:
> Mtek wrote:
> > Hi,
>
> > Well, I just thought I'd share this junk with everyone. We hired a
> > consulting firm to assist on a project. And, well, this is one of the
> > queries they came up with, which we intend to re-write, once we figure
> > out what the hell it is doing......
>
> Were you paying by the job or paying by the number of words?
Definitely php, the "//" signifies that that line is a comment, (this
code is word-wrapped).
PERL comments start with a #. >> Stay informed about: The Query From Hell |
|
| Back to top |
|
 |  |
External

Since: Apr 01, 2008 Posts: 60
|
(Msg. 3) Posted: Mon Feb 09, 2009 2:26 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Mtek schreef:
> Hi,
>
> Well, I just thought I'd share this junk with everyone. We hired a
> consulting firm to assist on a project. And, well, this is one of the
> queries they came up with, which we intend to re-write, once we figure
> out what the hell it is doing......
>
>
>
>
> if($compareType=='c') {
> $inQuery="'".$strTicker1."', '".$strTicker2."', '".$strTicker3."',
> '".$strTicker4."', '".$strTicker5."'";
> $getQuery="
> select my_left_table.fund_name,
> my_left_table.LINK,
> DECODE(fund_rank.curr_rank,NULL,'N/A',fund_rank.curr_rank)
> AS fund_rank,
> my_left_table.nav,
> my_left_table.TOTAL_RETURN_1YR,
> my_left_table.EXPENSE_RATIO,
> my_left_table.MARKET_VALUE_AVG,
> my_left_table.MGR_START_DATE
> from (
> SELECT MUTUAL_FUND.FUND_NAME,
> MUTUAL_FUND.TICKER,
> to_char( decode( FUND_DAILY_PRICES.NAV,to_char
> (-9999),'N/A',FUND_DAILY_PRICES.NAV ) ) AS NAV,
> to_char( decode( FUND_MASTER.TOTAL_RETURN_1YR,to_char
> (-9999),'N/A',FUND_MASTER.TOTAL_RETURN_1YR ) ) AS TOTAL_RETURN_1YR,
> to_char( decode( FUND_MASTER.EXPENSE_RATIO,to_char
> (-9999),'N/A',FUND_MASTER.EXPENSE_RATIO ) ) AS EXPENSE_RATIO,
> to_char( decode( FUND_MASTER.MARKET_VALUE_AVG,to_char
> (-9999),'N/A',FUND_MASTER.MARKET_VALUE_AVG ) ) AS MARKET_VALUE_AVG,
> CASE WHEN fund_master.mgr_start_date IS NULL THEN NULL
> ELSE TO_DATE( TO_CHAR( '01' || '/'||fund_master.mgr_start_date),'dd-mm-
> RRRR' ) END AS MGR_START_DATE,
> ('<a href=\"http://www.zacks.com/funds/mfrank/quotes.php?
> t='||MUTUAL_FUND.TICKER||'&type=main\">'||MUTUAL_FUND.TICKER||'</a>')
> AS LINK
> FROM MUTUAL_FUND, FUND_MASTER, FUND_DAILY_PRICES
> where MUTUAL_FUND.TICKER = FUND_DAILY_PRICES.TICKER
> AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID
> AND MUTUAL_FUND.TICKER IN( ".$inQuery." ))
> my_left_table left join fund_rank
> on my_left_table.ticker = fund_rank.ticker";
> } else {
> // Ashis : "$getQuery" problem in to_date(to_char('01' ||
> '-'||FUND_MASTER.MGR_START_DATE),'dd-mm-RRRR') function. when
> FUND_MASTER.MGR_START_DATE value is blank then query not execute. This
> causes we are added NVL function.
> $getQuery="
> select my_left_table.fund_name,
> my_left_table.LINK,
> DECODE(fund_rank.curr_rank,NULL,'N/A',fund_rank.curr_rank)
> AS fund_rank,
> my_left_table.nav,
> my_left_table.TOTAL_RETURN_1YR,
> my_left_table.EXPENSE_RATIO,
> my_left_table.MARKET_VALUE_AVG,
> my_left_table.MGR_START_DATE
> from (
> SELECT MUTUAL_FUND.FUND_NAME,
> MUTUAL_FUND.TICKER,
> to_char( decode( FUND_DAILY_PRICES.NAV,to_char
> (-9999),'N/A',FUND_DAILY_PRICES.NAV ) ) AS NAV,
> to_char( decode( FUND_MASTER.TOTAL_RETURN_1YR,to_char
> (-9999),'N/A',FUND_MASTER.TOTAL_RETURN_1YR ) ) AS TOTAL_RETURN_1YR,
> to_char( decode( FUND_MASTER.EXPENSE_RATIO,to_char
> (-9999),'N/A',FUND_MASTER.EXPENSE_RATIO ) ) AS EXPENSE_RATIO,
> to_char( decode( FUND_MASTER.MARKET_VALUE_AVG,to_char
> (-9999),'N/A',FUND_MASTER.MARKET_VALUE_AVG ) ) AS MARKET_VALUE_AVG,
> CASE WHEN fund_master.mgr_start_date IS NULL THEN NULL
> ELSE TO_DATE( TO_CHAR( '01' || '/'||fund_master.mgr_start_date),'dd-mm-
> RRRR' ) END AS MGR_START_DATE,
> ('<a href=\"http://www.zacks.com/funds/mfrank/
> quotes.php?t='||MUTUAL_FUND.TICKER||'&type=main\">'||
> MUTUAL_FUND.TICKER||'</a>') AS LINK
> FROM MUTUAL_FUND,
> FUND_MASTER,
> FUND_DAILY_PRICES
> where MUTUAL_FUND.TICKER = FUND_DAILY_PRICES.TICKER
> AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID
> AND MUTUAL_FUND.TICKER = '".$strTicker1."')
> my_left_table left join fund_rank
> on my_left_table.ticker = fund_rank.ticker
> UNION ALL
> SELECT FUND_NAME,
> ('<a href=\"http://www.zacks.com/funds/mfrank/quotes.php?
> t='||TICKER||'&type=main\">'||TICKER||'</a>'),
> DECODE(CURR_RANK,NULL,'N/A',CURR_RANK) AS fund,
> to_char(NAV),
> to_char(TOTAL_RETURN_1YR),
> to_char(EXPENSE_RATIO),
> to_char(MARKET_VALUE_AVG),
> m
> FROM (
> SELECT YTD_TICKERS.*,
> FUND_MASTER.TOTAL_RETURN_YTD,
> row_number() over( order by
> FUND_MASTER.TOTAL_RETURN_YTD desc ) as ytd_desc
> FROM (
> SELECT a.*,
> row_number() over( order by to_date(m,'dd-mm-RRRR') )
> as m_Asc
> from (
> SELECT MGR_TICKERS.*,
> to_date(to_char('01' || '-'||NVL
> (FUND_MASTER.MGR_START_DATE, '05/08')),'dd-mm-RRRR') as m
> FROM (
> SELECT *
> FROM (
> SELECT MUTUAL_FUND.FUND_NAME,
> MUTUAL_FUND.TICKER,
> FUND_RANK.CURR_RANK,
> decode(FUND_DAILY_PRICES.NAV,to_char(-9999),'N/
> A',FUND_DAILY_PRICES.NAV) AS
> NAV,
> decode(FUND_MASTER.MARKET_VALUE_AVG,to_char(-9999),'N/
> A',FUND_MASTER.MARKET_VALUE_AVG) AS
> MARKET_VALUE_AVG,
> decode(FUND_MASTER.TOTAL_RETURN_1MT,to_char(-9999),'N/
> A',FUND_MASTER.TOTAL_RETURN_1MT) AS TOTAL_RETURN_1MT,
> decode(FUND_MASTER.TOTAL_RETURN_3MT,to_char
> (-9999),'N/A',FUND_MASTER.TOTAL_RETURN_3MT) AS TOTAL_RETURN_3MT,
> decode(FUND_MASTER.TOTAL_RETURN_1YR,to_char
> (-9999),'N/A',FUND_MASTER.TOTAL_RETURN_1YR) AS TOTAL_RETURN_1YR,
> decode(FUND_MASTER.TOTAL_RETURN_3YR,to_char
> (-9999),'N/A',FUND_MASTER.TOTAL_RETURN_3YR) AS TOTAL_RETURN_3YR,
> decode(FUND_MASTER.TOTAL_RETURN_5YR,to_char
> (-9999),'N/A',FUND_MASTER.TOTAL_RETURN_5YR) AS TOTAL_RETURN_5YR,
> decode(FUND_MASTER.TOTAL_RETURN_10YR,to_char
> (-9999),'N/A',FUND_MASTER.TOTAL_RETURN_10YR) AS TOTAL_RETURN_10YR,
> decode(FUND_MASTER.STD_DEV_3YR,to_char
> (-9999),'N/A',FUND_MASTER.STD_DEV_3YR) AS STD_DEV_3YR,
> decode(FUND_MASTER.SHARPE_3YR,to_char
> (-9999),'N/A',FUND_MASTER.SHARPE_3YR) AS SHARPE_3YR,
> decode(FUND_MASTER.R_SQUARE_3YR,to_char
> (-9999),'N/A',FUND_MASTER.R_SQUARE_3YR) AS R_SQUARE_3YR,
> decode(FUND_MASTER.BETA_3YR,to_char(-9999),'N/
> A',FUND_MASTER.BETA_3YR) AS BETA_3YR,
> decode(FUND_MASTER.ALPHA_3YR,to_char(-9999),'N/
> A',FUND_MASTER.ALPHA_3YR) AS ALPHA_3YR,
> decode(FUND_MASTER.FEE_12B1_PERC,to_char
> (-9999),'N/A',FUND_MASTER.FEE_12B1_PERC) AS FEE_12B1_PERC,
> decode(FUND_MASTER.MIN_INIT_INVEST,to_char
> (-9999),'N/A',FUND_MASTER.MIN_INIT_INVEST) AS MIN_INIT_INVEST,
> decode(FUND_MASTER.MIN_SUBS_INVEST,to_char
> (-9999),'N/A',FUND_MASTER.MIN_SUBS_INVEST) AS MIN_SUBS_INVEST,
> decode(FUND_MASTER.PORTFOLIO_TURNOVER,to_char
> (-9999),'N/A',FUND_MASTER.PORTFOLIO_TURNOVER) AS PORTFOLIO_TURNOVER ,
> decode(FUND_MASTER.LARGE_GROWTH,to_char
> (-9999),'N/A',FUND_MASTER.LARGE_GROWTH) AS LARGE_GROWTH,
> decode(FUND_MASTER.LARGE_VALUE,to_char
> (-9999),'N/A',FUND_MASTER.LARGE_VALUE) AS LARGE_VALUE,
> decode(FUND_MASTER.SMALL_GROWTH,to_char
> (-9999),'N/A',FUND_MASTER.SMALL_GROWTH) AS SMALL_GROWTH,
> decode(FUND_MASTER.SMALL_VALUE,to_char
> (-9999),'N/A',FUND_MASTER.SMALL_VALUE) AS SMALL_VALUE,
> FUND_MASTER.EXPENSE_RATIO,
> row_number() over(order by EXPENSE_RATIO) as
> r_exp
> FROM MUTUAL_FUND,
> FUND_MASTER,
> FUND_RANK,
> FUND_DAILY_PRICES
> WHERE FUND_RANK.CURR_RANK in ".$rank."
> AND FUND_MASTER.OBJ_DESCR = '".$arrgetcat[0][0]."'
> AND MUTUAL_FUND.TICKER = FUND_RANK.TICKER
> AND MUTUAL_FUND.TICKER = FUND_DAILY_PRICES.TICKER
> AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID
> AND FUND_MASTER.MGR_START_DATE <> '-9999'
> AND FUND_MASTER.EXPENSE_RATIO <> -9999
> AND MUTUAL_FUND.TICKER <> '".$strTicker1."')
> EXP_TICKERS
> WHERE r_exp <= 20) MGR_TICKERS,
> MUTUAL_FUND,
> FUND_MASTER
> WHERE MGR_TICKERS.TICKER = MUTUAL_FUND.TICKER
> AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID) a)
> YTD_TICKERS,
> MUTUAL_FUND,
> FUND_MASTER
> WHERE YTD_TICKERS.TICKER = MUTUAL_FUND.TICKER
> AND MUTUAL_FUND.M_FUND_ID = FUND_MASTER.FUND_ID
> AND m_asc <= 10) top4tickers
> WHERE ytd_desc <= 4";
As far as I can see (apart from the size of this query) there is only
one small error in it (apart from some lingual errors), but I'm sure you
have found that one already!
Looks like they tried to put a complete spreadsheet in one query!
Shakespeare >> Stay informed about: The Query From Hell |
|
| Back to top |
|
 |  |
External

Since: Jul 30, 2008 Posts: 67
|
(Msg. 4) Posted: Mon Feb 09, 2009 4:25 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Mon, 09 Feb 2009 07:21:16 -0800, Mtek wrote:
> Hi,
>
> Well, I just thought I'd share this junk with everyone. We hired a
> consulting firm to assist on a project. And, well, this is one of the
> queries they came up with, which we intend to re-write, once we figure
> out what the hell it is doing......
>
>
Please, do me a favor and shoot the author. Not only is the query
completely uninteligible, it also doesn't use bind variables. Is this
Perl or PHP? It looks like a badly botched PHP application, but I am
not sure which one is it. The syntax of Perl and PHP is very, very
similar.
--
http://mgogala.freehostia.com >> Stay informed about: The Query From Hell |
|
| Back to top |
|
 |  |
External

Since: Apr 01, 2008 Posts: 60
|
(Msg. 5) Posted: Mon Feb 09, 2009 4:25 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Mladen Gogala schreef:
> On Mon, 09 Feb 2009 07:21:16 -0800, Mtek wrote:
>
>
>> Hi,
>>
>> Well, I just thought I'd share this junk with everyone. We hired a
>> consulting firm to assist on a project. And, well, this is one of the
>> queries they came up with, which we intend to re-write, once we figure
>> out what the hell it is doing......
>>
>>
>
> Please, do me a favor and shoot the author. Not only is the query
> completely uninteligible, it also doesn't use bind variables. Is this
> Perl or PHP? It looks like a badly botched PHP application, but I am
> not sure which one is it. The syntax of Perl and PHP is very, very
> similar.
>
>
>
zacks.com. Does it ring a bell?
Shakespeare >> Stay informed about: The Query From Hell |
|
| Back to top |
|
 |  |
External

Since: Jan 29, 2008 Posts: 46
|
(Msg. 6) Posted: Mon Feb 09, 2009 4:25 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Mtek wrote:
> Hi,
>
> Well, I just thought I'd share this junk with everyone. We hired a
> consulting firm to assist on a project. And, well, this is one of the
> queries they came up with, which we intend to re-write, once we figure
> out what the hell it is doing......
>
>
Were you paying by the job or paying by the number of words? >> Stay informed about: The Query From Hell |
|
| Back to top |
|
 |  |
External

Since: Jul 30, 2008 Posts: 67
|
(Msg. 7) Posted: Mon Feb 09, 2009 11:22 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Jul 30, 2008 Posts: 67
|
(Msg. 8) Posted: Mon Feb 09, 2009 11:23 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Apr 01, 2008 Posts: 60
|
(Msg. 9) Posted: Tue Feb 10, 2009 12:25 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Mladen Gogala schreef:
> On Mon, 09 Feb 2009 20:36:26 +0100, Shakespeare wrote:
>
>> zacks.com. Does it ring a bell?
>
> Nope. Should it ring a bell?
>
>
>
Yes, there are several posts in this group from different posters
(although I believe one poster uses several synonyms) with 'zacks.com'
in the code. One statement worse than the other...
Shakespeare >> Stay informed about: The Query From Hell |
|
| Back to top |
|
 |  |
External

Since: Jul 30, 2008 Posts: 67
|
(Msg. 10) Posted: Tue Feb 10, 2009 7:25 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Tue, 10 Feb 2009 17:55:58 +0100, Shakespeare wrote:
> Yes, there are several posts in this group from different posters
> (although I believe one poster uses several synonyms) with 'zacks.com'
> in the code. One statement worse than the other...
>
> Shakespeare
I went to URL in the code and inspected a bit. It's brilliant:
"Make It All BackZacks Announces Plan to Double Your Money
Zacks.com chief Steve Reitmeister has prepared our answer to the
recession. It's a potent plan to Make It All Back. Details
will only be confided to those who get on a private list, which closes
Feb. 14."
Double, no less! How didn't the others think of that? That Steve
Reitmeister must be a sheer genius! The details will, of course, cost
money and list closes on St. Valentine's Day! There must be a queue
forming right now! I was once taken aback when a used car salesman used
the phrase "trust me". This guy looks even less trustworthy then the guy
who tried to sell me 7 years old Ford Escort for $8k.
--
http://mgogala.freehostia.com >> Stay informed about: The Query From Hell |
|
| Back to top |
|
 |  |
External

Since: Jun 02, 2008 Posts: 99
|
(Msg. 11) Posted: Tue Feb 10, 2009 8:25 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Mladen Gogala wrote:
> On Tue, 10 Feb 2009 17:55:58 +0100, Shakespeare wrote:
>
>> Yes, there are several posts in this group from different posters
>> (although I believe one poster uses several synonyms) with 'zacks.com'
>> in the code. One statement worse than the other...
>>
>> Shakespeare
>
> I went to URL in the code and inspected a bit. It's brilliant:
>
> "Make It All BackZacks Announces Plan to Double Your Money
> Zacks.com chief Steve Reitmeister has prepared our answer to the
> recession. It's a potent plan to Make It All Back. Details
> will only be confided to those who get on a private list, which closes
> Feb. 14."
>
>
> Double, no less! How didn't the others think of that? That Steve
> Reitmeister must be a sheer genius! The details will, of course, cost
> money and list closes on St. Valentine's Day! There must be a queue
> forming right now! I was once taken aback when a used car salesman used
> the phrase "trust me". This guy looks even less trustworthy then the guy
> who tried to sell me 7 years old Ford Escort for $8k.
>
Let's not get too cynical. After all. soon it might get published by
Rampant Press as the silver bullet to cure all known ills. Present
company excepted, of course.
Palooka >> Stay informed about: The Query From Hell |
|
| Back to top |
|
 |  |
External

Since: Dec 20, 2007 Posts: 422
|
(Msg. 12) Posted: Wed Feb 11, 2009 1:44 pm
Post subject: Re: The Query From Hell [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
| Related Topics: | query.... - what is the purpose of sequence number in wireless ADHOC network? How attacker exploit sequence number for the purpose of attacking network?
Can someone help with this query - Hello Oracle experts, Well I need help changing the following query that I have constructed. I am really new at Oracle but trying my best. I need to create a report using crystal reports where at the top I show summary data and that encompasses all dat...
Ask for a query - Hello, I've got two tables, named Order and Customer. I want a query that let me see during a period per month wich customer bought something for the first time. Table Order contain a field Customer_ID and OrderDate Example: Period: Jan 1st 2005 -..
Help with query - -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm trying to come up with a query of v$undostat that will show the total # of undo blocks used during any two hour period. The output should look like this.. begin_time end_time undoblks..
Can someone simplify this query - Hi, SELECT * FROM (SELECT officecode off1, acno_code acc1, SUM (current_purchase_amount) sum1 FROM bweb_assetpurchasetxndetails GROUP BY officecode, acno_code) tab1, (SELECT officecode off2, account_code... |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|