Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Diff btwn AND & OR in WHERE clause?

Hi Experts,

Pls. clarify my simple doubt in SQLs WHERE clause, abt AND & OR use!!

my code is:

<i><b>1) where ( erdat in s_aedat

or aedat in s_aedat ).------>100 recs fetched

2)where erdat in s_aedat

or aedat in s_aedat .

3) where erdat in s_aedat

and aedat in s_aedat . -


>70 recs fetched</b></i>

thanq.

Tags:
replied

1) where ( erdat in s_aedat

or aedat in s_aedat ).------>100 recs fetched

In case 1 it does not need to satisfy both the conditions, either of the conditions satisfies and the record is retrieved.

ie if in the table there is value for erdat in s_aedat OR if there is a value for aedat in s_aedat the record is retrieved

2)where erdat in s_aedat

or aedat in s_aedat .

Case 2 is same as case 1

3) where erdat in s_aedat

and aedat in s_aedat . -


>70 recs fetched

In case 3 it need to satisfy both the conditions, only when both the conditions satisfies and the record is retrieved.

ie if in the table there is value for erdat in s_aedat AND if there is a value for aedat in s_aedat the record is retrieved, here if the data in the table matches for both the fields with the value given on the selection screen only the record is shown

Hope this is clear.

Regards

Gopi

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question