I work on sql server 2019 i face issue can't solve it
i need to display chemicalid that have different on chemicalmass and chemicalmassmodified
but if there are difference 0.01 then not display it as different i will consider it equal
so if difference between chemical mass and chemical mass modified is 0.01 i will consider it as equal and not difference
if difference between chemical mass and chemical mass modified is more than 0.01 then i will consider it difference
create table #mass
(
chemicalid int,
chemicalmass float,
chemicalmassmodified float
)
insert into #mass(chemicalid,chemicalmass,chemicalmassmodified)
values
(12378,12,12),
(67901,13,14),
(33022,71,71.5),
(55021,30.01,30.02),
(47211,1.5,1.52),
(90341,72,72),
(20980,0.05,0.04),
(87001,1.23,1.22)
Expected Result as below
chemicalid chemicalmass chemicalmassmodified
67901 13 14
33022 71 71.5
47211 1.5 1.52
What I have tried:
select * from #mass where
chemicalmass <> chemicalmassmodified