For example, if the front end can give a Date, then add Date=’someDate’ with necessary AND keyword, and also show up the Date column by SELECT. Otherwise that Date column do not show either in the condition string nor in the SELECT
It is like
if the Date is not null
then
Select .... Date as Date01 from TableName where ....AND Date01='someDate';
if the Date is null
then
Select .... from TableName where ..;
How to achieve such goal? Thank you.
If you want to return two separate select lists then you would need two queries to perform this.
You cannot hide a column in a
SELECTlist based on whether or not a date has been provided.If you want to include the column and the condition, then you can use a
caseexpression to provide a different value to the records that don’t have the condition. Similar to this: