Start a new topic

IN Clause not working

[This topic is migrated from our old forums. The original author name has been removed]

If I use the in clause, it just returns rows for the last variable in the clause: eg: and dtl.prpty_num in ('38','29') only returns rows for 29. If I do them individually, they each return rows, After more review, it appears that it is not the IN CLAUSE, but rather something else. When running the SQL one clause at a time, the IN clause worked, but to a point. The following worked , but add one more line it changes the results dramatically: select dtl.prpty_num, dtl.actv_ty_cd, dtl.asset_ty_cd, dtl.EFF_PD_NUM, dtl.BAN_NUM, trans_amt from FA_HIST_TRANS_DTL dtl where dtl.EFF_YR_NUM = 2009 and dtl.prpty_num in (38,29) and dtl.actv_ty_cd in ( 'DC', 'NB') and dtl.asset_ty_cd in (601,602) and dtl.EFF_PD_NUM = 1 and dtl.BAN_NUM = 300 returns 66 rows , which is fine, and all are WHLSL_MF_DIV_NUM = 2 BUT if I just add one more line : and dtl.WHLSL_MF_DIV_NUM = 2 then only 9 rows returned, and now it strangely uses the 2nd part of the above in clauses.. 29, NB, 602 then it reduces the results and Edited by: Brian on Jul 31, 2015 4:11 PM
1 Comment

[This reply is migrated from our old forums.]

Re: IN Clause not working
Hi Brian, You are more likely to get help if you ask about this in an a general SQL forum or a forum for the database you use. This forum is for questions about how to use the DbVisualizer features. DbVisualizer just sends the SQL statement to the database so the behavior you see is a database question, not a DbVisualizer question. Best Regards, Hans