learner
29th January 2003, 14:21
Hello ,
One suggesstion i need in SQL
i have the following fields on form
Transaction Type From To
Document No. From To
Doc. Date From To
Supplier From To
Trans. type nc1 nc2 nc3
not to be considered
for this i wrote the following query
QUERY 1
select tfgld106.*, tccom020.*
from tfgld106, tccom020
where tfgld106._index1 inrange {:ttyp.f, :ninv.f}
and {:ttyp.t, :ninv.t}
and tfgld106.dcdt between :date.f and :date.t
and tccom020._index1 = {tfgld106.suno}
and tfgld106.otyp <> :ttyp.nc1
and tfgld106.otyp <> :ttyp.nc2
and tfgld106.otyp <> :ttyp.nc3
order by tfgld106.leac
selectdo
endselect
QUERY 2
select tfgld106.*, tccom020.*
from tfgld106, tccom020
where tfgld106._index1 inrange {:ttyp.f, :ninv.f}
and {:ttyp.t, :ninv.t}
and tfgld106.dcdt between :date.f and :date.t
and tccom020._index1 = {tfgld106.suno}
and ( tfgld106.otyp <> :ttyp.nc1
or tfgld106.otyp <> :ttyp.nc2
or tfgld106.otyp <> :ttyp.nc3 )
order by tfgld106.leac
selectdo
endselect
Which one is the correct one , i feel that first one is the correct one. Am i right ?
please note that if the user specified in the nc1 or nc2 or nc3 those transaction types should not be considered i mean they should be skipped. I know this can also be done using CONTINUE keyword, but i would like to know which one in the above part is correct.
Regards
Learner
One suggesstion i need in SQL
i have the following fields on form
Transaction Type From To
Document No. From To
Doc. Date From To
Supplier From To
Trans. type nc1 nc2 nc3
not to be considered
for this i wrote the following query
QUERY 1
select tfgld106.*, tccom020.*
from tfgld106, tccom020
where tfgld106._index1 inrange {:ttyp.f, :ninv.f}
and {:ttyp.t, :ninv.t}
and tfgld106.dcdt between :date.f and :date.t
and tccom020._index1 = {tfgld106.suno}
and tfgld106.otyp <> :ttyp.nc1
and tfgld106.otyp <> :ttyp.nc2
and tfgld106.otyp <> :ttyp.nc3
order by tfgld106.leac
selectdo
endselect
QUERY 2
select tfgld106.*, tccom020.*
from tfgld106, tccom020
where tfgld106._index1 inrange {:ttyp.f, :ninv.f}
and {:ttyp.t, :ninv.t}
and tfgld106.dcdt between :date.f and :date.t
and tccom020._index1 = {tfgld106.suno}
and ( tfgld106.otyp <> :ttyp.nc1
or tfgld106.otyp <> :ttyp.nc2
or tfgld106.otyp <> :ttyp.nc3 )
order by tfgld106.leac
selectdo
endselect
Which one is the correct one , i feel that first one is the correct one. Am i right ?
please note that if the user specified in the nc1 or nc2 or nc3 those transaction types should not be considered i mean they should be skipped. I know this can also be done using CONTINUE keyword, but i would like to know which one in the above part is correct.
Regards
Learner