BaBernd
30th July 2015, 12:01
Hello to All,

I have a select Statement for a printing session:
select tssoc100.csqu, tssoc100.ofbp, tssoc100.desc
from tssoc100
where tssoc100._index1 inrange {:csqu.f} and {:csqu.t}
and tssoc100._index4 inrange {:ofbp.f} and {:ofbp.t}

This is not the full select but the important part.

Now I want to add a further "and" condition for the Quotation Terms (tssoc100.term). But this Terms I have to get out of another table called tsctm110 Configuration lines. And there should the where condition formulated for the reference activities tsctm110.crac.
Additional: there is no index for tssoc100.term created in tssoc100.

So my question is, can I write my select as I described below:
and tssoc100.term = select tsctm110.term where tsctm110.crac inrange {:cact.f} and {:cact.t}

Further remark:
{:csqu.f}; {:csqu.t}; {:ofbp.f}; {:ofbp.t}; {:cact.f}; {:cact.t} are variables for the enter fields on the session mask / form.

Best Regards
Bernd

sam291091
30th July 2015, 12:13
Hi
try this
tssoc100.term in (select tsctm110.term where tsctm110.crac inrange {:cact.f} and {:cact.t})

vamsi_gujjula
30th July 2015, 12:55
yes you can write the sub query as mentioned above by Sam .

But sub queries reduce the performance , rather you can filter then out in select do...

BaBernd
30th July 2015, 16:33
Hi Sam, Hi Vamsi,

thanks for your help. I've first used the code as Sam mentioned:
tssoc100.term in (select tsctm110.term where tsctm110.crac inrange {:cact.f} and {:cact.t})

This code is running fast enough yet.

But Vamsi, thanks for the advice with "doselect". When I Need more than one value of tsctm110, for example the tsctm110.crac then I will use the doselect Option.

Best Regards
Bernd