I've tried solutions shown in here, here, here and here
But no success, here are the two queries I'm tring to convert into one:
q1
SELECT c.corpus_initial
FROM
(SELECT SUBSTRING_INDEX(corpus, '_', 1) AS corpus_initial
FROM corpus_info WHERE corpus
IN
(SELECT corpus FROM corpus_alignments)) c GROUP BY c.corpus_initial
q2
SELECT c.title_initial
FROM
(SELECT SUBSTRING_INDEX(title, ' (', 1) AS title_initial
FROM corpus_info WHERE corpus
IN
(SELECT corpus FROM corpus_alignments)) c GROUP BY c.title_initial
UPDATE
some data: the table corpus_info has many fields but the two important ones are corpus and title, first I filter the results comparing to table corpus_alignments, so if the data is in this later table then I take out the last part of the results and marge them....
table corpus_info
| corpus | title |
_______________________________________________
| btdeucat_de | BancTrad Deutch-Catalan (de) |
_______________________________________________
| btdeucat_ca | BancTrad Deutch-Catalan (ca) |
_______________________________________________
| btengspa_en | BancTrad English-Spanish (en) |
_______________________________________________
| btengspa_sp | BancTrad English-Spanish (sp) |
_______________________________________________
So from column corpus I get: btdeucat and btengspa without the _xx and not duplicated and from column title I get: BancTrad Deutch-Catalan and BancTrad English-Spanish without the (xx) and not duplicated