Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

MySql join table to a concat field

New Here ,
Jun 10, 2010 Jun 10, 2010

Hi

I have a view and within my select i have a concat statement to bring 3 fields together.

I would then like to join another table to the view which would join to the concatonated field I have made.

is this possible to do or would I need to write a second view referencing the first one to do it?

many thanks for any help

Simon

TOPICS
Server side applications
878
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 10, 2010 Jun 10, 2010

Do you mean, you will join another table, and a field from that table will be added to current CONCAT statement?

Also, if you could post your current SQL statement, and second table, field names you want to add etc. would help

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 10, 2010 Jun 10, 2010
LATEST

Hi

Thanks for replying - I have figured it out and below is the example in case anyone searches for this another time.

I wanted to just join a new table on the new field I formed by concatonating fields.

This was my concat field

select concat_ws('_',`ut_postrace`.`race`.`BREED`,`ut_postrace`.`event`.`TRACK`,`ut_postrace`.`pool`.`POOL`) AS `RebateID`,

This is how I joined a new table to that field


join `united_tote`.`_colreb` on((concat_ws('_',`ut_postrace`.`race`.`BREED`,`ut_postrace`.`event`.`TRACK`,`ut_postrace`.`pool`.`POOL`) = convert(`united_tote`.`_colreb`.`Rebate_id` using utf8))))

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines