sql - How to mapping data with text multi level? -


how write sql statement?

table_product +------------------+ |     product      | +------------------+ |      aaa         | |      abb         | |      abc         | |      acc         | +------------------+ 


table_mapping  +---------------+---------------+ |  productgroup |  productname  | +---------------+---------------+ |     a*        |    product1   | |     abc       |    product2   | +---------------+---------------+ 

i need following result:

+------------+---------------+ |  product   |  productname  | +------------+---------------+ |    aaa     |   product1    | |    abb     |   product1    | |    abc     |   product2    | |    acc     |   product1    | +------------+---------------+ 

thanks, tom

the following query describe when run within access application itself:

    select table_product.product, table_mapping.productname             table_product         inner join         table_mapping             on table_product.product = table_mapping.productgroup     instr(table_mapping.productgroup, "*") = 0 union     select table_product.product, table_mapping.productname             table_product         inner join         table_mapping             on table_product.product table_mapping.productgroup     instr(table_mapping.productgroup, "*") > 0         , table_product.product not in (select productgroup table_mapping) order 1 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -