July 14, 2012 at 4:11 am
Can you please help me to get the median using the cursor
How I wrote the following code using the cursor
Do I really need help please
UPDATE tblGas01G4C40Total
SET Median Consumption =
(((SELECT Max( DailyConsumption ) FROM
(SELECT TOP 50 PERCENT DailyConsumption
FROM participation_cntInformation_Archieve90 INNER JOIN
tblGas01G4C40Total ON participation_cntInformation_Archieve90.ID_NO= tblGas01G4C40Total.ID_No
ORDER BY masrafrozane)As h1)
+
(SELECT MIN( DailyConsumption )
FROM(SELECT TOP 50 PERCENT DailyConsumption
FROM participation_cntInformation_Archieve90 INNER JOIN
tblGas01G4C40Total ON participation_cntInformation_Archieve90.ID_NO= tblGas01G4C40Total.ID_No
ORDER BY masrafrozane DESC) AS h2))/2)
July 16, 2012 at 8:02 am
This was removed by the editor as SPAM
July 16, 2012 at 8:09 am
This was removed by the editor as SPAM
July 16, 2012 at 8:12 am
This is a repeated post and was solved in here
http://www.sqlservercentral.com/Forums/Topic1329746-392-1.aspx
By the way, I made the same mistake as Stewart
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply