Hello All,
I am looking for a way to perform a calculation on the results of weight and height. I need see if there is a result for the height and weight for a person on the same date since they are entered at the same time. If so, then I need to perform the calculation (weight/(height*height)) x 703.
Any help would be appreciated.
Thank you.
Code:
USE TempDB
GO
CREATE TABLE dbo.HeightWeight
( Name VARCHAR(50),
Date DateTime,
Description VARCHAR(50),
Result VARCHAR(20)
)
INSERT INTO HeightWeight
(Name,Date,Description,Result)
SELECT 'Test1','2009-05-01','Height','60' UNION ALL
SELECT 'Test1','2009-05-01','Weight','175' UNION ALL
SELECT 'Test1','2009-05-02','Height','60' UNION ALL
SELECT 'Test1','2009-05-02','Weight','176' UNION ALL
SELECT 'Test2','2009-05-03','Height','65' UNION ALL
SELECT 'Test2','2009-05-03','Weight','190' UNION ALL
SELECT 'Test3','2009-05-04','Height','68' UNION ALL
SELECT 'Test3','2009-05-04','Weight','180' UNION ALL
SELECT 'Test4','2009-05-05','Height','63' UNION ALL
SELECT 'Test4','2009-05-05','Weight','185'