If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > LIKE command

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-17-09, 17:41
asaini asaini is offline
Registered User
 
Join Date: Apr 2009
Posts: 2
LIKE command

Guys,

I have a list of accounts in table A, which I need to see if they are in table B or not. That's easy, but the problem is that accounts in table A can be in present in different fashion asin table B. Example
Table A Table B
123 00123
1111 984511123
15677 1567745
44567 4456700000
If I had to check single account,I would have used LIKE command as %accountno%. But I am not sure how to do this for batch of account numbers.
Reply With Quote
  #2 (permalink)  
Old 04-17-09, 18:14
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by asaini
Guys,

I have a list of accounts in table A, which I need to see if they are in table B or not. That's easy, but the problem is that accounts in table A can be in present in different fashion asin table B. Example
Table A Table B
123 00123
1111 984511123
15677 1567745
44567 4456700000
If I had to check single account,I would have used LIKE command as %accountno%. But I am not sure how to do this for batch of account numbers.
Interesting. How do you know if "984511123" matches "1111" and not "9845" or "1123"? Anyway, I would use the LOCATE() function for a task like this.
Reply With Quote
  #3 (permalink)  
Old 04-17-09, 18:37
asaini asaini is offline
Registered User
 
Join Date: Apr 2009
Posts: 2
Thanks Nick.

Ideally I would be linking the accounts from both tables to surnames from "details" table. This would ensure that matching account we found in table 2 infact is related to account in table1.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On