> -----Ursprüngliche Nachricht-----
> Von:  Ferdinand, Dieter 
> Gesendet am:  Donnerstag, 22. August 2002 10:56
> An:   '[EMAIL PROTECTED]'
> Betreff:      problem with null values by insert into .. select ..from ..
> join
> 
> hello,
> i have one problem with insert into ... select ... from .. join ...
> 
> my query:
> insert into tkanlage(standort,nummer,name,vorname,
>        pname,pvorname,pnachname,
>        pnr)
>          select if(i.rv='J',3,if(pe.standort=0 or pe.standort is null or
> pe.standort=3,1,pe.standort)) as standort,
>  
> ^^^^^^^^^^^^^^^^^^^^^^
>                                                           here is the
> problem, without this checked with if, the record is set to NULL
>  
> i.directory_number,i.directory_name,i.directory_first_name,
>                 i.displayed_name,i.phone_book_first_name,i.displayed_name,
>                 p.directory_name
>                 from import_tk as i
>                      left join import_tk as p on
> p.directory_number=i.directory_number
>                                              and p.users>0
>                      left join personal as pe on pe.pnr=p.directory_name
> and austritt<'1900-1-1'
>                 where i.users=0
> 
> when a field from the join is in the fieldlist and this field is null,
> then the whole record is set to null.
> 
> server version: 3.23.49
> 
> a bug with null values by this function is also in version 3.22.xx.
> here is used the last value which was in this files at last time.
> 
> when i check this with if and use a initial value, than it works, but this
> is only a workaround.
> 
> goodby
> 
>    Mit freundlichen Grüßen
>    Dieter Ferdinand
> 
>  
> ______________________________________________________________________
>  
>  Nothelfer 
>     ______________________________________________________________________
> 
>    Abteilung EDV
> 
>    Schlossstr. 22     D - 66687 Wadern - Lockweiler
> 
>    Phone      + 49 (6871) 60 - 1211
>    Mobil      + 49 (178)  5238926 oder 5518414
>    FAX        + 49 (6871) 60 - 0 -  1211
>    E-mail     [EMAIL PROTECTED] 
>    Internet   www.nothelfer.com
> 

---------------------------------------------------------------------
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