Answers:
这取决于您使用的是哪个供应商的SQL,但是,我会说它将是以下内容:
SELECT * FROM table WHERE column BETWEEN value1 AND value2
或者,你可以使用
SELECT * FROM table WHERE column <= value1 AND >= value2
这样的事情(在SQL Server 2008 R2中)你有什么想法?
CREATE TABLE Tab
(
X FLOAT NOT NULL,
Y FLOAT NOT NULL,
Z FLOAT NOT NULL,
ZZ AS Y / Z
);
INSERT INTO Tab
VALUES
( 1, 2, 3 ),
( 0.1, 0.2, 0.3 ),
( 0.1, 0.5, 1 ),
( 0.2, 0.4, 0.8 ),
( 0.5, 1, 1.5 );
SELECT X, Y, Z, ZZ
FROM Tab;
DECLARE @Delta FLOAT;
SET @Delta = 0.5;
SELECT X, Y, Z, ZZ, ZZ - @Delta, ZZ + @Delta
FROM Tab
WHERE X BETWEEN ZZ - @Delta AND ZZ + @Delta;
我想更直接你在寻找......
SELECT X, (Y/Z) AS ZZ FROM Table WHERE (Y/Z) BETWEEN (Y/Z) - .5 AND (Y/Z) + .5