List:General Discussion« Previous MessageNext Message »
From:王旭 Date:May 15 2008 5:35am
Subject:Re: CONCAT doesn't work with NULL?
View as plain text  
i execute follow sql.

select concat_ws('','d','\n','c');


the result is :

+----------------------------+
| concat_ws('','d','\n','c') |
+----------------------------+
| d
c                        |
+----------------------------+

There are no result as you said.


----- Original Message ----- 
From: "Afan Pasalic" <afan@afan.net>
To: "ewen fortune" <ewen.fortune@stripped>
Cc: <mysql@stripped>
Sent: Thursday, May 15, 2008 12:52 AM
Subject: Re: CONCAT doesn't work with NULL?


> actually, this will not work for me (or I got it wrong :D) because I 
> need to have street, state and zip in one line and with separator 
> defined on the beginning it will put everything in separate lines.
> :D
> 
> 
> 
> 
> ewen fortune wrote:
>> Hi Afan,
>> You can use concat_ws
>> 
>> http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws
>> ---
>> CONCAT() returns NULL if any argument is NULL.
>> CONCAT_WS() does not skip empty strings. However, it does skip any
>> NULL values after the separator argument
>> ---
>> 
>> Ewen
>> 
>> On Wed, May 14, 2008 at 5:53 PM, Afan Pasalic <afan@stripped> wrote:
>>> hi,
>>>
>>>  I have query
>>>  SELECT CONCAT(r.first_name, ' ', r.last_name, '\n', r.organization, '\n',
>>> r.title, '\n', a.address1, '\n', a.city, ', ', a.state, ' ', a.zip, '\n',
>>> r.email)
>>>  FROM registrants r, addresses a
>>>  WHERE r.reg_id=121
>>>
>>>  if any of columns has value (e.g. title) NULL, I'll get as result 0
>>> records.
>>>  If query doesn't have concat() - it works fine.
>>>
>>>  Why is that?
>>>
>>>  -afan
>>>
>>>  --
>>>  MySQL General Mailing List
>>>  For list archives: http://lists.mysql.com/mysql
>>>  To unsubscribe:
>>> http://lists.mysql.com/mysql?unsub=ewen.fortune@stripped
>>>
>>>
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1n
> 
>
Thread
CONCAT doesn't work with NULL?Afan Pasalic14 May
  • Re: CONCAT doesn't work with NULL?Olexandr Melnyk14 May
    • Re: CONCAT doesn't work with NULL?wim.delvaux14 May
  • Re: CONCAT doesn't work with NULL?ewen fortune14 May
    • Re: CONCAT doesn't work with NULL?Afan Pasalic14 May
    • Re: CONCAT doesn't work with NULL?Afan Pasalic14 May
      • Re: CONCAT doesn't work with NULL?wim.delvaux14 May
  • RE: CONCAT doesn't work with NULL?Randall Price14 May
    • Re: CONCAT doesn't work with NULL?Afan Pasalic14 May
    • Re: CONCAT doesn't work with NULL?Afan Pasalic21 May
    • relay-bin.000157' not found Charles Brown7 Aug
      • Re: relay-bin.000157' not foundMoon's Father12 Aug
  • Re: CONCAT doesn't work with NULL?Paul DuBois14 May
  • Re: CONCAT doesn't work with NULL?王旭15 May