Select min() returning value other than 0

Asked

Viewed 1,538 times

0

I need to make one select where you take the lowest value found, other than 0 (zero),

SELECT MIN(VALORTARIFA) MENORTARIFA FROM TABELA

In the above command, if there is some value 0.00, it will return 0.00 to me and I wish only the highest value above 0.00, (0.01) I am already interested.

There’s a way I can get it ?

  • 3

    Tried with a WHERE ?

  • Are you doing this in both banks? is it Mysql or Sql-Server?

  • No. only in SQL Server

  • 5

    SELECT MIN(VALUE CHARGED) MENORTARIFA FROM TABLE Where value > 0 ?

1 answer

2


In that case the solution is to use the Where.

SELECT MIN(VALORTARIFA) MENORTARIFA 
FROM TABELA 
WHERE VALORTARIFA > 0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.