CanuckBuck
Hall of Fame
Points: 3915
More actions
April 9, 2008 at 8:37 am
#184341
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?
kgunnarsson
Ten Centuries
Points: 1218
April 9, 2008 at 9:17 am
#800486
select min(column name1 ) , min(column name 2),min(column name 3)
kgunnarssonMcitp Database Developer.
antonio.collins
SSCrazy Eights
Points: 9600
April 9, 2008 at 9:27 am
#800489
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
#800492
That's it! Thanks.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply