Hello,

   I'm relatively new to mysql and I've come
across a problem while trying to insert
values from

multiple tables into a single, existing
table. Here's the syntax that I'm using:


insert into table1 (col1,col2,col3,col4)
select Foo.col1, Foo.col2, Bar.col3,
Bunk.col4 from table2 as

Foo, table3 as Bar, table4 as Bunk where
Foo.col1 = 5 and Bar.col1 = 5 and Bunk.col1 =
5;


This works fine so long as the where clause
is true. Now here's my problem: I used AND in

the above example however, what I want is for
each expression to be evaluated individually,

like an OR that will not stop if the first
expression is true. So, each of the source
tables may or

may not satisfy the condition, if they do,
then the proper value is inserted into
table1, if they

do not, then some default value should be
inserted into table1 (null). This is an if /
else problem but

I don't know if mysql supports anything of
the sort or if I need to use some sort of
script to work
around this prolem.

Any advice would be greatly appreciated.
Thanks.


Justin

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to