RE: Spam: like in db2

RE: Spam: like in db2

 

  

How about something like this:

select * from employee
where firstname like '%' || lastname || '%';

By using || to concatenate a % to the beginning and end of the last name the
SQL should work. Of course, this might not be exactly what you are looking
to do. But you get the idea.

Cheers,
Craig S. Mullins
Director, Technology Planning
BMC Software
http://www.BMC.com
http://www.DBAzine.com
http://www.CraigSMullins.com

-----Original Message-----
From: Birendra Kumar Kabi Satpathy
[mailto:db2udbdba-ezmlmshield-x46688043.[Email address protected]
Sent: Tuesday, March 29, 2005 5:38 AM
To: LazyDBA Discussion
Subject: RE: Spam: like in db2



You can use
db2 select * from employee where firstnme=lastname

let me know

-----Original Message-----
From: Samuel
[mailto:db2udbdba-ezmlmshield-x19117242.[Email address protected]
Sent: Tuesday, March 29, 2005 4:54 PM
To: LazyDBA Discussion
Subject: Spam: like in db2

Hi all,
Anybody explain me how can I use 'like ' in which leftside argument
is a column and in right side I have to place a column?

example: select firstname from table_name where firstname like lastname

where table_name is the table with columns firstname and lastname.

While I am doing loke this I am getting "SQL error: SQLCODE: -132,
SQLSTATE: 42824".

comments please...

Thanks,
Sam.


---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



----------------------------------------------------------------------------
-----------------
This message, including any attachments, contains confidential information
intended for a specific individual and purpose, and is intended for the
addressee only. Any unauthorized disclosure, use, dissemination, copying, or
distribution of this message or any of its attachments or the information
contained in this e-mail, or the taking of any action based on it, is
strictly prohibited. If you are not the intended recipient, please notify
the sender immediately by return e-mail and delete this message.


---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html

DB2 & UDB email list listserv db2-l LazyDBA home page