Discussione:
Between
(troppo vecchio per rispondere)
michela
2004-09-09 10:51:05 UTC
Permalink
E' possibile utilizzare Between escludendo gli estremi?

Es.
select * from Tabella where Perc between 1 and 0

mi deve restituire tutte le percentuali comprese tra 0 e 100% esclusi gli
estremi

io ho risolto così:
select * from Tabella WHERE Perc< 1 AND Perc > 0
ma mi piacerebbe capire se posso usare between...
Sicuramente è una cavolata...

grazie in anticipo

michela
Lorenzo Benaglia
2004-09-09 11:56:02 UTC
Permalink
Post by michela
E' possibile utilizzare Between escludendo gli estremi?
Es.
select * from Tabella where Perc between 1 and 0
mi deve restituire tutte le percentuali comprese tra 0 e 100% esclusi
gli estremi
select * from Tabella WHERE Perc< 1 AND Perc > 0
ma mi piacerebbe capire se posso usare between...
Ciao Michela,

no, l'operatore BETWEEN per definizione prende in considerazione anche gli
estremi.
La soluzione che hai adottato è perfetta ed è anche quella consigiata sui
Books Online:

"To specify an exclusive range, use the greater than (>) and less than
operators (<)."
Post by michela
grazie in anticipo
Prego.

Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://mvp.support.microsoft.com
http://italy.mvps.org
Luca Bianchi
2004-09-09 11:56:35 UTC
Permalink
Post by michela
E' possibile utilizzare Between escludendo gli estremi?
No, a meno che...
Post by michela
select * from Tabella WHERE Perc< 1 AND Perc > 0
...non fai proprio questo...
Post by michela
grazie in anticipo
michela
Bye
--
Luca Bianchi
Microsoft MVP - SQL Server
http://mvp.support.microsoft.com
http://italy.mvps.org
Loading...