SQL LIKE Statement
Posted on 2012-08-17
Table1: (Contains employee pin number)
Table2: (Contains cust#(6), inv#(10),employee comments(max)
1111112222222222123456Hello Joe1123456Whats going on159753Nothing going on here
4444443333333333652136Hi235689Go Bears652136Go Cubs and Soxs456789No way
6666669999999999159753Superbowl here we come456789No way, New England will win
What I need to do, is count how many times a pin# appears in each record of table 2's employee comments field.
I need count by custno and inv#.
There are many comments stored in the employee comment field.
If the same pin# appears more than once in same record, then you count more then once.
I am thinking about using the LIKE statement somehow, but not sure how.
1111112222222222 should have a count of 3
4444443333333333 should have a count of 4
6666669999999999 should have a count of 2