One of my Access 2000 queries includes a calculated field named Target, based on several columns in the queried tables. The calculation works fine as it is, however I want to compare the end result to another column in the same query, and if it exceeds the value in this column, I want to equalize this. Right now it's something like:
Target: round(Column1 * Column2 / Column3 + Column4)
I want to compare the result of this to Column5, and then equalize it if it exceeds Column5. Something like "If Target > Column5 then Target = Column5", but then in SQL lingo.
Not sure how to go about this. Is there an SQL solution for this - comparing the values of two columns and taking the highest of the two, for instance - or will I need to write a VBA function for this? If so, what would it look like?
Thanks in advance!
"Much that I bound, I could not free. Much that I freed returned to me."
(Lee Wilson Dodd)
Target: round(Column1 * Column2 / Column3 + Column4)
I want to compare the result of this to Column5, and then equalize it if it exceeds Column5. Something like "If Target > Column5 then Target = Column5", but then in SQL lingo.
Not sure how to go about this. Is there an SQL solution for this - comparing the values of two columns and taking the highest of the two, for instance - or will I need to write a VBA function for this? If so, what would it look like?
Thanks in advance!
"Much that I bound, I could not free. Much that I freed returned to me."
(Lee Wilson Dodd)