Results 1 to 11 of 11

Thread: Computing Grade

Threaded View

  1. #1

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Computing Grade

    Hi!

    I am using SP and part of which is to get the average of a certain subject...I am doing it like
    Code:
    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 I am not getting any result at all so I tried doing it like
    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%'
    but still its not correct. it's a syntax error.

    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 SP
    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,
    I hope, I explained it clearly. Anyone can help me please?
    Last edited by Simply Me; Oct 28th, 2012 at 02:10 AM. Reason: Wrong Title
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width