postgresql - Join tables on string value -


i have 2 tables , b. each of them has column "name" of type string. want records joining operation a.name sub string of b.name.

select * inner join b on a.name concat('%',b.name,'%'); 

the result empty table. goes wrong query, because got results if test via

select * cross join b a.name 'test' , b.name '%test%'; 

there got records static value "test".

the first query matching b substring of a. need:

select * inner join b on b.name concat('%',a.name,'%'); 

or

select * inner join b on position(a.name in b.name) > 0; 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo