2007 May 31 8:43 PM
Hello All,
I have a requirement in which i have to do a select statement where (Field1 = 'X') and (Field2 = 'A' or Field2 = 'B').
But if i write it directly,
select * from Ztable into table itab where Field1 = 'X' and Field2 = 'A' or Field2 = 'B'.
Then I am not getting the expected result.
instead i need something which tells the where clause to do OR operation first and then AND operation..
Any ideas ??
Thanks in advance.
Tatvagna Shah.
2007 May 31 8:46 PM
Hi,
Please try this.
select *
from Ztable
into table itab
where Field1 = 'X' and ( Field2 = 'A' or Field2 = 'B' ).
Regards,
Ferry Lianto
Hello All,
I have a requirement in which i have to do a select statement where (Field1 = 'X') and (Field2 = 'A' or Field2 = 'B').
But if i write it directly,
select * from Ztable into table itab where Field1 = 'X' and Field2 = 'A' or Field2 = 'B'.
Then I am not getting the expected result.
instead i need something which tells the where clause to do OR operation first and then AND operation..
Any ideas ??
Thanks in advance.
Tatvagna Shah.
2007 May 31 8:46 PM
Hi,
Please try this.
select *
from Ztable
into table itab
where Field1 = 'X' and ( Field2 = 'A' or Field2 = 'B' ).
Regards,
Ferry Lianto
2007 May 31 9:02 PM
Hi,
Actually...just got a hint at almost the same time you answered...!!
Still 10 points for you....Just coz, you were the only one to reply.
Thanks.
Tatvagna.
2008 Apr 04 5:46 PM
Also, you must remember that parentheses and operators are keywords, and must therefore be preceded and followed by at least one space.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |