Jump to content

Recommended Posts

"+" is arithmetic addition operator.

 

[pre]

  f1    |    f2    |

---------+------------+

  ham    |    x      |

  y    |    spam    |

  culpa  |    mea    |

[/pre]

 

  
SELECT * WHERE CONCAT(f1, f2) LIKE '%am%'

will return all 3, if that is the result you want.

 

Teng's version

SELECT * WHERE f1 LIKE '%am%' OR  f2 LIKE '%am%'

will return the first 2.

 

Depends on how you want it

hello fenway

I have my table like that

 

main(varchar)  sub(varchar)        result of using "+"

------------  ---------------    ------------------

  10                      Red                  10

  10                      Blue                  10

  12                      Green                12

  Red                      null                  0

  Blue                    null                    0

  White                  null                    0

 

 

as you see I get zeros !!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.