I am working in SQL Server 2012. I know I can use there 'where' clause in a query to do a multi-variable search on a single column, eg.:
select * from cars where manufacturer in ('Ford', 'Toyota')
would return all rows that have Fort or Toyota as the manufacturer. However, what if I needed to be more specific, and I wanted to see cars made from Ford in 1995, and cars made in Toyota in 1996? Doing a query like this:
select *
from cars
where manufacturer in ('Ford', 'Toyota')
and year in ('1995', 1996)
would bring me back the data I needed, but also cars Toyota made in 1995, and cars Ford made in 1996, which I do not want in my dataset. I've seen some suggestions to do a query like this:
select *
from cars
where (manufacturer, year) in (('Ford', '1995'), ('Toyota', 1996))
However, this does not compile... I'm thinking this is a MySQL query. I would also like to be able to take the parameters for the where query from other tables, and not have to type in 'Ford', 'Toyota', '1995' every time I want to search
INinstead ofAND,OR? The last statement isn't standard SQL