hi
I have this query
select * from tbl_BOOK_MAGZ
where NO_BOOKs <= 200 OR NO_MAGZ <= 200
when I'm runing this query It wil work only for the first part "where NO_BOOKs <= 200"
but it will not work in the other part "OR NO_MAGZ <= 200" it will give me also the NO_MAGZ which is even >200
can you help on that ??
Loading
ToBePosted Dec 25, 2013, 9:56 AM
ToBePosted Dec 25, 2013, 1:08 AM
ID
NO_BOOKS
NO_MAGZ
33-01
200
0
33-02
146
0
33-03
0
400
33-04
0
200
33-05
500
67
see My query depend on the No_BOOKS and ignoring the NO_MAGZ
Unless the NO_BOOKS are 0 I should check the NO_MAGZ
so in the table above it should only retrun ID :
33-01
33-02
33-04
You got my point now :)
Girish SapariyaPosted Dec 24, 2013, 8:14 AM
It will display record in case either NO_BOOKs <=200 OR NO_MAGZ <=200
select * from tbl_BOOK_MAGZ
where NO_BOOKs <= 200 OR NO_MAGZ <= 200
When u get NO_MAGZ greater than 200 in output, condition for NO_BOOKs <=200 is satisfied, thats why u getting that output.
Your query is right as per your requirement.
Thanks... :)
ToBePosted Dec 24, 2013, 8:06 AM
Girish SapariyaPosted Dec 24, 2013, 7:50 AM
assume this table as your output
id NO_BOOKs NO_MAGZ
1 100 150
2 150 200
3 0 170
4 180 0
now, if NO_BOOKs = 210 and NO_MAGZ = 150, should it be consider it in output?
ToBePosted Dec 24, 2013, 7:37 AM
you got it now ?
Girish SapariyaPosted Dec 24, 2013, 7:27 AM
can u tell us What output do you want exactly?
ToBePosted Dec 24, 2013, 7:10 AM
Girish SapariyaPosted Dec 24, 2013, 6:47 AM
use 'AND' instead of 'OR'
select * from tbl_BOOK_MAGZ
where NO_BOOKs <= 200 AND NO_MAGZ <= 200
hope this helps :)