[UPHPU] Complex SELECT statment in MySQL

jeffrey neslen jneslen at yahoo.com
Mon Nov 15 11:46:26 MST 2004

I have a situation that calls for me to update rows in
my db who's certain individual rows add up to a
certain checksum and was hoping I could get some
suggestions on how to build my UPDATE statement in

I have a table in my db that contains information
about certain items that we need to checkoff as we
send out the items to a customer.  For Example my
table contains the following set of information:

TABLE 'customer_checklist'(
customer_id varchar(25) primary key,
application enum('0','1') default 0,
sample_kit enum('0','1') default 0,
verification_form enum('0','1') default 0,
daily_call enum('0','1') default 0)

Now I am looking to UPDATE all the row's daily_call =
0 WHERE the sum of application + sample_kit +
verification_form are == 2.  In other words if any
combination of application, sample_kit, and
verification_form value's add up to 2 then those are
the rows I want to change the daily_call from 1 to 0.

I know it probably calls for a nested select
statement, but I can't seem to figure out how I would
select a sum of three column per row.  Let me know if
anyone has a solution.



Do you Yahoo!? 
Check out the new Yahoo! Front Page. 

More information about the UPHPU mailing list