-
Nov 13th, 2012, 08:21 PM
#1
Thread Starter
PowerPoster
CASE WHEN problem
Hi!
I am trying to get the General Average of the students and I want to have the results displayed in column GenAve, GenAve2 and so on... I tried the code below and its working but I dont know how will I make the results be displayed in GenAve and GenAve respectively and also, how do I make the result 77.257000 to display as 77.257?
Code:
select IDNO,LastName, FirstName, MI,YearLevel,SectionName,GenAve,GenAve2,
CASE
--First Grading
WHEN YearLevel='LC7' and SectionName='FirstYearSection1' THEN
Round((((Filipino * 1.2) + (English * 1.5) + (Math * 1.5) + (Science * 1.8) + ([Araling Panlipunan] * 1.2) +
(TLEComputer * 1.2) + (MAPEH * 1.2) + (CLEESP * 0.9) + ([Earth Science] * 1))/11.5),3)
--Second Grading
WHEN YearLevel='LC7' and SectionName='FirstYearSection1' THEN
Round((((Filipino2 * 1.2) + (English2 * 1.5) + (Math2 * 1.5) + (Science2 * 1.8) + ([Araling Panlipunan2] * 1.2) +
(TLEComputer2 * 1.2) + (MAPEH2 * 1.2) + (CLEESP2 * 0.9) + ([Earth Science2] * 1))/11.5),3)
END
-
Nov 13th, 2012, 10:01 PM
#2
Thread Starter
PowerPoster
Re: CASE WHEN problem
by the way I just updating my table. How do I use UPDATE in the above code?
-
Nov 15th, 2012, 07:42 AM
#3
Re: CASE WHEN problem
Your question is very unclear but I think you're after something like this:-
select IDNO,LastName, FirstName, MI,YearLevel,SectionName,
Round((((Filipino * 1.2) + (English * 1.5) + (Math * 1.5) + (Science * 1.8) + ([Araling Panlipunan] * 1.2) + (TLEComputer * 1.2) + (MAPEH * 1.2) + (CLEESP * 0.9) + ([Earth Science] * 1))/11.5),3) as GenAve,
Round((((Filipino2 * 1.2) + (English2 * 1.5) + (Math2 * 1.5) + (Science2 * 1.8) + ([Araling Panlipunan2] * 1.2) + (TLEComputer2 * 1.2) + (MAPEH2 * 1.2) + (CLEESP2 * 0.9) + ([Earth Science2] * 1))/11.5),3) as GenAve2
If that's not what you're after then I think you're going have to be MUCH clearer in your question. Show us some data and the desired result.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|