sql - How to retrieve records based on two equals condition for the same column? -


i have table columns id(primary key,number), name(varchar), value(number) , key(number).i want retrieve records have key=1 , key=2. can write query using not equals condition(!=) makes query long.this tried

select * user_details name='sam' , key != 3 , key != 4 , key != 5 , key != 6 , key != 7 , key != 8 ,  

so on.could suggest me oracle query can retrieve records have key=1 , key=2 rather checking not equals condition.

update: suggested in answer want know if in supported in hibernate

select * user_details key=1 or key=2 

or

select * user_details key in (1,2) 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -