Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select Statement

Former Member
0 Likes
532

Hi all,

in the select statement below i have two fields 'augst' and 'augob'. they can hold values '9' and 'X' respectively. I should ignore the records if any one of the field has value or if both have values. iam able to get it correct for the later query but how can i ignore the records if any one of the fields hold a value.

SELECT opbel budat waers betrw INTO TABLE rev_doc FROM dfkkop

WHERE vkont = contractaccount

AND hvorg = '6000'

AND tvorg = '1412'

AND augst NE '9'

AND augob NE 'X'.

Please send your suggestions,

Raj.

1 ACCEPTED SOLUTION
Read only

varma_narayana
Active Contributor
0 Likes
499

Hi

Try this

SELECT opbel budat waers betrw INTO TABLE rev_doc FROM dfkkop

WHERE vkont = contractaccount

AND hvorg = '6000'

AND tvorg = '1412'

AND augst EQ ' '

AND augob EQ ' '.

or

SELECT opbel budat waers betrw INTO TABLE rev_doc FROM dfkkop

WHERE vkont = contractaccount

AND hvorg = '6000'

AND tvorg = '1412'

AND augst IS INITIAL

AND augob IS INITIAL.

4 REPLIES 4
Read only

varma_narayana
Active Contributor
0 Likes
500

Hi

Try this

SELECT opbel budat waers betrw INTO TABLE rev_doc FROM dfkkop

WHERE vkont = contractaccount

AND hvorg = '6000'

AND tvorg = '1412'

AND augst EQ ' '

AND augob EQ ' '.

or

SELECT opbel budat waers betrw INTO TABLE rev_doc FROM dfkkop

WHERE vkont = contractaccount

AND hvorg = '6000'

AND tvorg = '1412'

AND augst IS INITIAL

AND augob IS INITIAL.

Read only

Former Member
0 Likes
499

Try out in this way

SELECT opbel budat waers betrw INTO TABLE rev_doc FROM dfkkop
WHERE vkont = contractaccount
AND hvorg = '6000'
AND tvorg = '1412'
AND augst = ' ' and augob = ' ' .

Read only

Former Member
0 Likes
499

hi



if augst ne '' or augob NE ''.
error message "or u  dont write anything here.

else

SELECT opbel budat waers betrw INTO TABLE rev_doc FROM dfkkop
WHERE vkont = contractaccount
AND hvorg = '6000'
AND tvorg = '1412'
AND augst NE '9'
AND augob NE 'X'.

endif.

it will work for u

regards

ravish

<b>plz dont forget to reward if useful</b>

Read only

Former Member
0 Likes
499

hi raj,

u can define u query in this fashion....

SELECT opbel budat waers betrw INTO TABLE rev_doc FROM dfkkop

WHERE vkont = contractaccount

AND hvorg = '6000'

AND tvorg = '1412'

AND ( augst NE '9' and augob NE 'X' ) OR

( augst NE '9' and augob NE ' ' ) OR

( augst NE ' ' and augob NE 'X' ) .

this may help u.

please reward incase usefull...

regards,

prashant