I want to create a statement like the following:
if (select statement1 returns rows){
select statement2
}
else {
select statement3
}
This if statement is part of a bigger query
select from products where p.id in (
if (select statement1 returns rows){
select statement2
}
else {
select statement3
}
Is this possible in SQL Server, or is my thinking incorrect?