April 9, 2008 at 8:37 am
Hi.
I have created a query which joins three tables on a compound primary key. The resulting query has three "data" columns each containing a real (numeric) value representing a depth. I need to be able to find the minimum of the three.
Anyone know how to do that?
April 9, 2008 at 9:17 am
select min(column name1 ) , min(column name 2),min(column name 3)
kgunnarsson
Mcitp Database Developer.
April 9, 2008 at 9:27 am
if you want 1 value from 3 columns:
(case when col1 < col2 and col1 < col3 then col1
when col2 < col1 and col2 < col3 then col2
else col3 end) as colMin
April 9, 2008 at 9:29 am
That's it! Thanks.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply