Hi!
I am using SP and part of which is to get the average of a certain subject...I am doing it likebut I am not getting any result at all so I tried doing it likeCode:UPDATE tblgrade SET [MAPEH] =((MUSIC * .25) + (ARTS * .25) + (PE * .25) + (HEALTH * .25)) FROM tblenrol WHERE tblGrade.IDNO = tblenrol.IDNO AND tblGrade.yearlevel = tblenrol.yearlevel AND tblenrol.SubjectName like 'MUSIC%' AND tblenrol.SubjectName like 'ARTS%' AND tblenrol.SubjectName like 'PE%' AND tblenrol.SubjectName like 'HEALTH%'but still its not correct. it's a syntax error.Code:UPDATE tblgrade SET [MAPEH] =((tblenrol.SubjectName like 'MUSIC%' * .25) + (ARTS * .25) + (PE * .25) + (HEALTH * .25)) FROM tblenrol WHERE tblGrade.IDNO = tblenrol.IDNO AND tblGrade.yearlevel = tblenrol.yearlevel AND tblenrol.SubjectName like 'MUSIC%' AND tblenrol.SubjectName like 'ARTS%' AND tblenrol.SubjectName like 'PE%' AND tblenrol.SubjectName like 'HEALTH%'
Music, Arts, PE, and Health are subjects in my other table. I had them converted as fields in the table where I would like to have the Final grade to appear.
here's part of my SPI hope, I explained it clearly. Anyone can help me please?Code:CREATE TABLE [dbo].[tblGrade]( [IDNo] [nvarchar](10) NOT NULL, [LastName] [nvarchar](50) NULL, [FirstName] [nvarchar](50) NULL, [MI] [nvarchar](50) NULL, [Reading] [numeric](5, 0) NULL, [Language] [numeric](5, 0) NULL, [English] [numeric](5, 0) NULL, [Math] [numeric](5, 0) NULL, [Music] [numeric](5, 0) NULL, [Arts] [numeric](5, 0) NULL, [PE] [numeric](5, 0) NULL, [Health] [numeric](5, 0) NULL, [MAPEH] [numeric](5, 0) NULL,




Reply With Quote