Subject Re: [ib-support] SQL STATEMENT.HOW TO?
Author hans
Sorry forgot the where line:

create procedure StudentScore (Subject MyVarText(4) )
returns (Name VarChar(20),
Score Integer,
Subject VarChar(4),
ValueTotal Integer))
as
begin
ValueTotal = 0;

Select Name,Sum(Score),Subject from TableStudentScores
where Subject = :MySubject
Group by Name
Order ny Name
into :Name,
:Score,
:Subject
do
begin
ValueTotal = ValueTotal + Score;
Suspend;
end
end

----- Original Message -----
From: "hans" <hans@...>
To: <ib-support@yahoogroups.com>
Sent: Monday, January 06, 2003 10:08 PM
Subject: Re: [ib-support] SQL STATEMENT.HOW TO?


> I don't think you can do this with a straight sum(whatever) sql
> statement, but 'select * from StudentScore ('eng') might do
> it and more .. id expanded a bit, like class average for each
> student per subject
>
> create procedure StudentScore (Subject MyVarText(4) )
> returns (Name VarChar(20),
> Score Integer,
> Subject VarChar(4),
> ValueTotal Integer))
> as
> begin
> ValueTotal = 0;
>
> Select Name,Sum(Score),Subject from TableStudentScores
> Group by Name,Subject
> Order ny Name,Subject
> into :Name,
> :Score,
> :Subject
> do
> begin
> ValueTotal = ValueTotal + Score;
> Suspend;
> end
> end
>
> --------------------------------------------------------------------------
--
> -----------
>
> ----- Original Message -----
> From: <dorst622@...>
> Newsgroups: egroups.ib-support
> To: <ib-support@yahoogroups.com>
> Sent: Monday, January 06, 2003 7:28 PM
> Subject: [ib-support] SQL STATEMENT.HOW TO?
>
>
> > I got this records
> >
> > seq name score subject
> > 1 tom 10 eng
> > 2 jimmy 11 eng
> > 3 wendy 8 eng
> > 4 mandy 5 eng
> > 5 tom 5 math
> > 6 wendy 4 math
> > 7 jimmy 9 math
> >
> >
> > what sql statement to used if i want to receive this result.
> > valuetotal is the cumulative of value score
> >
> > seq name score subject valuetotal
> > 1 tom 10 eng 10
> > 2 jimmy 11 eng 21
> > 3 wendy 8 eng 29
> > 4 mandy 5 eng 34
> >
> > dorst622@...
> >
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > ib-support-unsubscribe@egroups.com
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>