-1

I have the two select queries below :

SELECT column_1 FROM table_name WHERE **column_2= 'X'** AND scope= 'scope';
SELECT column_1 FROM table_name WHERE **column_2= 'Y'** AND scope='scope';

I want to pass each of the above queries to a predefined SQL method:

So far only the following syntax has worked, but in this case it is just passing the same value to both parameters:

select function_name(table_name.column_1, table_name.column_1) FROM table_name
WHERE column_2= 'X' AND scope='scope';

I would like to do something like this but it is not working:

select function_name(SELECT column_1 FROM table_name WHERE **column_2= 'X'** AND
scope= 'scope', SELECT column_1 FROM table_name WHERE **column_2= 'Y'** AND 
scope='scope');
AAEM
  • 1,837
  • 2
  • 18
  • 26

1 Answers1

0

You can try-

SELECT column_1 FROM table_name WHERE column_2= 'X' OR column_2= 'Y' AND scope= 'scope';

As the resulting column is same and also the query table is same you can combine the two conditions.

theboringdeveloper
  • 1,429
  • 13
  • 17