Your create view statement would be as below
CREATE VIEW vw_YourTableName
AS
SELECT t.IDNO,t.name,t.[Date],t.Price1,t.Price2,
CASE WHEN t.Price2 > t1.Price2 THEN 1
WHEN t.Price2 < t1.Price2 THEN -1
ELSE 0
END AS Comp
FROM Table t
LEFT JOIN Table t1
ON t1.IDNO = t.IDNO + 1
AND t1.name = t.name
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
No comments:
Post a Comment