|  | Posted by Jerry Stuckle on 01/23/06 04:24 
Dave Smithz wrote:> Thanks for the input.
 >
 >>OK so you want to subvert the normalization your database. This is
 >>marginally more acceptable than cross-posting.
 >
 > Did not understand the first sentence. Is this a good or bad thing?
 >
 >>So that rules out subselects.
 >
 > Yes it is annoying that I have to support MySQL 3
 >
 >
 >>
 >>Messy if you only want to find out whom has not attended:
 >>
 >>SELECT a.student_id
 >>FROM students a LEFT JOIN studentclasslink b
 >>       ON a.student_id=b.student_id
 >>HAVING b.student_id IS NULL
 >
 >
 > Good point in finding how many members have not attended. The SQL I gave was
 > to more demonstrate my problem. Even with the above code, I still do not
 > know how I apply this to an update situation.
 > My worse case scenario is to in the PHP code store the row id's of the rows
 > that need to be updated. But I was thinking there should be an SQL method.
 >
 >
 >>As to what you do next - I guess you already know that since you posted to
 >>comp.lang.php (amongst others)
 >
 >
 > Not wanting to get away from the main pont, I only posted into two related
 > groups. Sometimes it is not clear to which group to post. I do not see why
 > it is such a problem cross posting if the groups are carefully selected and
 > relevant. Maybe it is the Newsreader I use does not make it a problem, and
 > maybe I will now hear otherwise, but what really is the big problem with the
 > occasional cross posting on groups that are related. Surely it is better
 > then posting the same message twice into each group but at different times.
 >
 > Kind regards
 >
 > Dave
 >
 >
 
 Dave,
 
 I agree this is subverting the normalization process.  Why update a
 field with this information?  Just use your select statement, adding
 
 HAVING count(class_id) = 0;
 
 This will get all the students with no classes.
 
 Otherwise you need to run the update statement before you run the select
 - duplicate work.
 
 As to whether to post here or someplace else.  This is the wrong place
 to post.  You have a SQL question, not a PHP question.
 comp.databases.mysql would be a much better place to ask this question.
 
 
 
 --
 ==================
 Remove the "x" from my email address
 Jerry Stuckle
 JDS Computer Training Corp.
 jstucklex@attglobal.net
 ==================
 [Back to original message] |