Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Help with Select Query to compare data

$
0
0

Hi all

This is from a school system, we calculate the Grade Point Average for reports, I have a query where this works well for one session but I need to compare data over two semesters. The main difference being 'Academic Period' and 'Foreign Subject' SO essentially I want to combine these two Selects into one

I know I need to change the alias in the second query but other than that is it possible?

FIRST

select a.student_id,contact_id,a.foreign_student,first_name,surname,

avg(70.0 - ASCII(a.gradeb01)) as achieve_num,

avg(70.0 - ASCII(a.gradeb02)) as effort_num

from wm_stma_archive as a left join wm_contact on a.student_id=wm_contact.contact_id

where a.academic_period = 8

and (((a.Gradeb01 is not null) AND (a.Gradeb01 'N/A')) AND ((a.Gradeb02 is not null)AND (a.Gradeb01 'N/A')))

and (left(a.foreign_subject,2)='09')

group by...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>