I have to generate a single sql query, which retrieves two columns from two tables.
In where clause the id is 1,2,3,4 and 5.
How to form a single query with the above specified condition.
I need only sql query but not cursor or functions concept.
Eg;
select column 1, column2 from table1, table2 where id=1
select column 1, column2 from table1, table2 where id=2
select column 1, column2 from table1, table2 where id=3
select column 1, column2 from table1, table2 where id=4
How to make these multiple queries into a single query???
Thanks in Advance.
make use of wher in clause will resolve your issue easily …
The IN Operator
The IN operator allows you to specify multiple values in a WHERE clause.