Ascalonian
Programmer
I have a SQL statement structured similar to:
All fine and dandy. However, what if I want to use the above SQL in a report and want to change the SYSDATE to another date the user chooses? Is there a way in SQL to do this? I know that the inner-select knows nothing about the oh or ol, which means I can't set a date somewhere else and have the inner select recognize it like:
Again, I appreciate the help.
Code:
SELECT oh.header_id,
ol.line_id,
ol.line_number
FROM order_headers oh,
order_lines ol
WHERE oh.header_id IN (SELECT x.header_id
FROM some_table x
WHERE ordered_date = SYSDATE)
AND ol.header_id = oh.header_id
All fine and dandy. However, what if I want to use the above SQL in a report and want to change the SYSDATE to another date the user chooses? Is there a way in SQL to do this? I know that the inner-select knows nothing about the oh or ol, which means I can't set a date somewhere else and have the inner select recognize it like:
Code:
SELECT oh.header_id,
ol.line_id,
ol.line_number
FROM order_headers oh,
order_lines ol
WHERE oh.header_id IN (SELECT x.header_id
FROM some_table x
WHERE ordered_date = oh.some_date)
AND ol.header_id = oh.header_id
Again, I appreciate the help.