Ask the slow operation when using the subwoofer inside when

Hi all

I am creating a query according to the following conditions:

Select count (*) in A Alpha, Beta B
where
(case
When
A.col1 = 'Pete' and substr (A.col2, 1, 12) = substr(B.col2,1,12)
then 1
on the other
-for all other cases, when A.col1 is not equal to 'Pete', substr 1-15 must be checked on A and B
When A.col1! = 'Pete' and substr (A.col2, 1, 15) = substr(B.col2,1,15)
then 1
0 otherwise
end) = 1

When I run the whole application together, he continues to run forever and I finally have to kill him. However, when I run the 2 WHEN clauses separately, it runs within a second and get me the correct data. What's not all by merging these two inside 2 WHEN clauses that it causes the query to drag?


Please notify.

Thanks in advance.

Not sure

Do you mean that you need much counts separately? or a combined County?

How you unite their alpha and beta tables? What is the join condition?

you need to do something like that,

SELECT COUNT(CASE WHEN
                    (A.col1 = 'Pete' AND SUBSTR(A.col2,,1,12)=SUBSTR(B.col2,,1,13))
                 OR ( A.col1 != 'Pete' AND SUBSTR(A.col2,,1,15)=SUBSTR(B.col2,,1,15))
                THEN 1 ELSE 0
             END)
FROM alpha A, beta b
WHERE alpha.join_cloumn= beta.join_column

G.

Tags: Database

Similar Questions

Maybe you are looking for

  • Firefox has not loaded correctly, is not a problem of (IMO) graphics card

    I have a problem when playing "pets" on tagged.com. I'm using Firefox 33.0.2 on Windows 8 http://www.uploadhouse.com/ViewFile.php?id=20142918 http://www.uploadhouse.com/ViewFile.php?id=20142917

  • Satellite C660-258 - Internet connection issues

    Recently, my laptop started to suffer serious problems when you try to connect to the internet.My download and upload slow to a crawl (only for laptop) Usually (according to speedtest.net) I get around a download about 4 but on my laptop it reaches m

  • restore the iPod mini to factory settings

    How is - someone restores an old mini iPod to factory settings?

  • Tecra A8 - password at startup asked

    I have a laptop that I want to format and reload (ed), but when I start it, it shows the Toshiba screen, then immediately the black screen asking password, won't even close to starting Windows. Laptop:Toshiba Tecra A8 Here is what I tried already aft

  • HP Pavilion: Bios Admin or power on password

    Hello I have a Hp Pavilion protectsmart, when I boot his request for an Admin or a power on password Serial number is [removed personal information] Press enter several times and the system hangs with code 57929804 Please could someone help Thank you