sql - Query to compare 3 different data columns with a reference value -
I need to check that a table (in an Oracle DB) contains entries that have a fixed date Was updated later. In this case "Renewal" means that any 3 columns ( DateCreated , DateDeleted ) have more value than references. The question I have raised so far is this:
Choose from myTable where the date is & gt; : Reference_date or date & gt; : Reference_date or date deleted & gt; :reference date ; This works and gives the desired results, but what I want is not because I would like to enter the value for : reference_date only once How can I write a more elegant query to any idea?
What do you like and only uses a bind variable, if for some reason If you are positioned rather than the nominal bind, then you should be it avoid the need to supply multiple values by using inline views or CTE:
Also select myTable as CT (Select: reference_date to reference_data from two references). * Include whistle with myTable in myTable.DateCreated & gt; Cte.reference_date or myTable.DateModified & gt; Cte.reference_date or myTable.DateDeleted & gt; Cte.reference_date; But again, I do not think it is better than your original, unless you really have no problem supplying forced reason and bind value. It would probably not be counted as a compelling to set it three times by a calling program, for example, for me anyway and I will check that it will not affect the performance before deployment - I hope that Oracle will do this Customize something, but execution plans are interesting.
Comments
Post a Comment