2021-10-30

Oracle BETWEEN from subquery

Is something like this possible?

SELECT *
FROM [TABLE1]
WHERE [FIELDA] BETWEEN
    (SELECT [FIELDB], [FIELDC] 
     FROM [TABLE2]
     WHERE [set of conditions to ensure single record]);

Instead of doing:

SELECT *
FROM [TABLE1]
WHERE [FIELDA]
  BETWEEN (SELECT [FIELDB] FROM [TABLE2] WHERE [set of conditions to ensure single record])
  AND (SELECT [FIELDB] FROM [TABLE2] WHERE [set of conditions to ensure single record]);

Thanks,



from Recent Questions - Stack Overflow https://ift.tt/3BvTUNw
https://ift.tt/eA8V8J

No comments:

Post a Comment