|
Query issue with where clauses "IN" and "OR"
|
|
Hello everybody.
So i'm having a strange event ( at least to me) on a client DB.
There are a couple of queries that are made on top of a view. ( nothing new here ).
Now the strange thing for example in the query bellow, by using this where clause "in", the server gives me an error, 5702.
But if i change the in clause to multiple "OR", it runs....
Why is that??
Code:
select count(*)
from v_MOVIMENTOS_SEC
where deleted = 0
and tipomilitante in (select tipomilitanteid from TIPOMILITANTE where upper(descricao) = 'MILITANTE')
and movimentoid in ( 147256404 , 147256504 , 147256472 , 147256473,
147256474 , 147256475 , 147256490 , 147256476 , 147256477 ,
147256478 , 147256479 , 147256480 , 147256481 , 147256482 ,
147256483 , 147256485 , 147256486 , 147256487 , 147256488 ,
147256489 , 147256411 , 147256491 , 147256492 , 147256493 ,
147256494 , 147256495 , 147256496 , 147256497 , 147256498 ,
147256499 , 147256413 , 147256465 , 147256500 , 147256501 ,
147256505 , 147256503 , 147256414 , 147256506 , 147256466 ,
147256467 , 147256468 , 147256469 , 147256507 , 147256508 ,
147256509 , 147256510 , 147256511 , 147256512 , 147256513 ,
147256514 , 147256515 , 147256516 , 147256517 , 147256518 ,
147256519 , 147256520 , 147256521 , 147256522 , 147256523 ,
147256524 , 147256525 , 147256526 , 147256527 , 147256528 ,
147256529 , 147256530 , 147256531 , 147256408 , 147256532 ,
147256533 , 147256534 , 147256563 , 147256535 , 147256536 ,
147256537 , 147256538 , 147256502 , 147256539 , 147256540 ,
147256541 , 147256542 , 147256543 , 147256544 , 147256545 ,
147256403 , 147256546 , 147256412 , 147256547 , 147256548 ,
147256549 , 147256550 , 147256551 , 147256552 , 147256554 ,
147256553 , 147256555 , 147256556 , 147256557 , 147256558 ,
147256559 , 147256464 , 147256560 , 147256561 , 147256562 ,
147256484 , 147256409 , 147256415 , 147256416 , 147256462 ,
147256410 , 147256463 , 147256471 , 147256470 , 147256407 ,
147256406 , 147256417 , 147256418 , 147256419 , 147256420 ,
147256421 , 147256422 , 147256423 , 147256424 , 147256425 ,
147256426 , 147256427 , 147256428 , 147256429 , 147256430 ,
147256431 , 147256432 , 147256433 , 147256434 , 147256435 ,
147256436 , 147256437 , 147256438 , 147256439 , 147256440 ,
147256441 , 147256442 , 147256443 , 147256444 , 147256445 ,
147256446 , 147256447 , 147256448 , 147256449 , 147256450 ,
147256451 , 147256452 , 147256453 , 147256454 , 147256455 ,
147256456 , 147256457 , 147256458 , 147256459 , 147256460 ,
147256461 , 147256564 , 147256565 , 147256566 , 147256568 ,
152256568 , 152256569 , 162256570 , 167256573 , 172256584 ,
172256586 , 177256574 , 177256575 , 187256592 , 192256576 ,
197256581 , 207256583 , 207256584 , 207256585 , 147256405 ,
157256571 ) order by seccaoid , numeroOrdenacao
Thank you very much.
|
|