optimization of query

Database

optimization of query

Is there any best way tho achive the the result same as max or min does gives???

i find the query performance getting hampered becoz of the min function i m using in my query and if i comment the aggregate function it work absolutely fine..!!

please let me know how to write the optimize function for the beloq syntax..!!

just an FYI, clssfctn_scp and AC are two different table..!!

  MIN(CASE WHEN clssfctn_scp.scp='LI'   THEN   AC.abc_clssfctn ELSE '' END ) AS ABC_Classification_LI 

, MIN(CASE WHEN clssfctn_scp.scp='HC' THEN   AC.abc_clssfctn  ELSE '' END ) AS ABC_Classification_HC   

, MIN(CASE WHEN clssfctn_scp.scp='CL'   THEN   AC.abc_clssfctn   ELSE ''END ) AS ABC_Classification_CL 

waiting for your valuable reply

7 REPLIES
N/A

Re: optimization of query

Vijay,

DDL and a descripton of what you are trying to accomplish with the min function would help someone help you.

Robert

Re: optimization of query

i just wanted to do we have other wayaround to replace the min fucntion with other syntax

N/A

Re: optimization of query

If your query runs "absolutely fine" without MIN then why do you want to use it? :-)

Without additional details nobody will be able to help.

Re: optimization of query

I have a query in SQL server using PIVOT function, samle query working in SQL server like -

select PT.* from (select FName, LName, RDate, Rank from Tab_Ranking)sq

pivot (max(Rank) for RDate in ([2013-08-20], [2013-08-21])) as PT

What would be the equivalent query or presentation in Teradata? Please help.

N/A

Re: optimization of query

Posting the same question repeatedly will not provide you with any additional answer than the one posted by Raja:

http://forums.teradata.com/forum/general/teradata-pivot-function-equivalence-of-oracle-or-sql-server...

Re: optimization of query

  MIN(CASE WHEN clssfctn_scp.scp='LI'   THEN   AC.abc_clssfctn ELSE '' END ) AS ABC_Classification_LI 

, MIN(CASE WHEN clssfctn_scp.scp='HC' THEN   AC.abc_clssfctn  ELSE '' END ) AS ABC_Classification_HC   

, MIN(CASE WHEN clssfctn_scp.scp='CL'   THEN   AC.abc_clssfctn   ELSE ''END ) AS ABC_Classification_CL 

details:

here AC.abc_clssfctn filed have value ranging from A-D where A is good and D bad,

so what we want select the good classification level for the clssfctn_scp.scp in LI,HC,CL..!!

does it make sense dnoeth??????????

N/A

Re: optimization of query

"Additional details" means DDL, actual query and Explain...