sql - Comparing records from different tables with slightly different data -


i have 2 tables. each table has product information , price. able results show product name , both prices. however, product name in each table written differently. e.g.

table 1

name                       price            pack size aciclovir 200 mg tablets     3.50             25 aciclovir 400 mg tablets     4.20             56 aciclovir 800 mg tablets     5.40             35 aciclovir cream              2.40             gm 

table 2

aciclovir 200mg tabs           1              25 aciclovir 200mg tabs           1              25 aciclovir 400mg tabs           2              56 aciclovir 5% cream  2gm        2.30           na 

i've tried like, i'm not getting results need.

in case (and in sql server), can suggest use this:

replace(a.name, ' ', '') replace(replace(b.name, ' ' ,''), 'tabs', 'tab%s') or  replace(b.name, ' ' ,'') replace(replace(a.name, ' ', ''), 'cream', '%cream%') 

i can tell when have changing remove compare when want ignore ' ' remove , on. when mg changing can remove in compare, remove ignore texts using replace().


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -