Subject | Re: [firebird-support] Sloooow query |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2003-06-26T11:39:55Z |
On 26 Jun 2003 at 10:46, Bisma J wrote:
student itself? An additional field "Accepted_to"?
Then instead "NOT IN (...)" you can simply write "accepted_to is
not null and accepted_to <> this_school".
Doesn't you have a table with a list of schools?
query to pieces in SP.
SY, Dimitry Sibiryakov.
>The "is_selected" field is marked by the application and if it isWhy do you select students' application then? Why not select a
>marked (true) means the student accepted in the "school". I have to
>make sure that my application only marks one row for every student
>selection data, because a student cannot be accepted in more than one
>school.
student itself? An additional field "Accepted_to"?
Then instead "NOT IN (...)" you can simply write "accepted_to is
not null and accepted_to <> this_school".
> (SELECT student_id FROM student_selectionAnd I also wonder why your table student_selection is denormalized.
> WHERE is_selected='T'
> AND priority<2
> AND school<>'School A')
>/* sort grade from highest to lowest to make sure */
>/* the school get first highest grade of the students */
>ORDER BY b.grade DESC, b.birth_date;
Doesn't you have a table with a list of schools?
>Any idea to make the query run faster?Bring your schema to third normal form. Think about breaking your
>For any kind of responses, I thank you in advance.
query to pieces in SP.
SY, Dimitry Sibiryakov.