Asamoa
Asamoa

Reputation: 149

select all rows when its values smaller than specify number?

i have a table :

a       b       c
1       10     1001
7       6      54
56     2000    31
1200    5      9
4       10     20
2       65     20

how can i select rows with column's value of this row smaller than 1000. i want to get this

a       b       c
7       6      54
4       10     20
2       65     20

mysql query still get all value :

SELECT a,b,c FROM test
    where a <'1000' or b<'1000' or c<'1000'

Upvotes: 0

Views: 846

Answers (1)

SMK
SMK

Reputation: 96

It sounds like you would like to pull a row where there is NO column greater than 1000 in that row, if that is correct then you need to us AND instead of OR.

SELECT a,b,c FROM test
where a <'1000' AND b<'1000' AND c<'1000'

Hope that helps!

Upvotes: 1

Related Questions