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
I saw this code somewhere but I don't quite well understand it...
Code:
select (select count(*) from locations where url is null) as unprocessed, (select count(*) from locations where url is not null) as processed, (((select processed / (unprocessed + processed)) * 100)) as "% complete";
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.
Select (Select count(*) from tblenrolk12
WHERE tblGradeK12.IDNO = tblenrolK12.IDNO
AND tblGradeK12.yearlevel = tblenrolK12.yearlevel
AND tblenrolK12.SubjectName like 'MUSIC%'
AND tblenrolK12.SubjectName like 'ARTS%'
AND tblenrolK12.SubjectName like 'PE%') as MAPEH
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.
I understand now what you mean in post #2..How will I get then the MAPEH grade when I have 4 subjects (Music, Arts, PE, Health) where I will get 25% from each subject? Any code where I get started with?
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.
When you get a response, you shouldn't reply 5 times before understanding it. Before you post again you should work it out, and act on it appropriately.... and if you can't work it out yourself, your first reply after it should be to ask questions to help you understand it. Just ignoring it as you did is rather rude.
I for one do not see the point in attempting to help somebody who acts the way you did (especially someone who has thousands of posts), so I'm out of here.
I'm sorry but I don't mean to be rude sir...at first I just didn't get what you meant in your post #2 I did reply in post #3 where I answered "I have subjectname like Music1, Music2, Arts1, Arts2 etc..." that was my answer because I misunderstood what you meant by "How can SubjectName start with two different things at the same time?"
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.