Reputation: 1125
How to retrieve / output values that match multiple table fields.
SELECT name FROM table WHERE name IN ( 'Value1', 'Value2' );
My search query should take the following parameters : first_name and roll_number in user_table.
e.g. Retrieving a query on the following lines : Roy whose roll number is 5
I need to query this using a single query.
Upvotes: 0
Views: 57
Reputation: 142
Select * from tableName
where roll_number =5
and first_name ='ROY'
--replace 5 and ROY with parameter
Upvotes: 1
Reputation: 1135
Consider writing the following sql statement:
SELECT name FROM table_name WHERE first_name IN ('Roy') AND roll_number = 5;
You can alternatively try the following query:
SELECT name FROM table_name WHERE first_name = 'Roy' AND roll_number = 5;
Upvotes: 2