Hi John,

Kebbel, John wrote:
I have a table of middle school students I want to update quarterly. I
am only interested in finding and adding new students (not in finding
and deleting students who have been dropped from the school district).
I'm pretty sure I could put together a PHP script that would do this,
but is there a MySQL way for one MySQL table (preceding quarter) to scan
another MySQL table (current quarter) by primary key (student id number)
and absorb the unmatched, new students? I'm thinking that if f I could
bypass PHP, I could use MySQL triggers to automatically add new records
to other, related tables.

It sounds to me like you want an "exclusion join":

insert into new_students(...)
select current_quarter.*
from current_quarter
        left outer join preceding_quarter using(student_id)
where preceding_quarter.student_id is null;

Baron

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to