Dynamic columns based or rows of other rows - mysql

Hi Team,
Below is my table
Table 1 => Language
id, code, language 1, es, Spanish 2, de, German

Table 2 => Content
id, language, data1, data2, data3 1, es, data1content1-es, data2content1-es, data3content1-es 2, es, data1content2-es, data2content2-es, data3content2-es 3, de, data1content1-de, data2content1-de, data3content1-de 4, de, data1content2-de, data2content2-de, data3content2-de

Where data1, data2 and data3 contains translated text for lanaguage
The resultant table I want is
data1_es, data2_es, data3_es, data1_de, data2_de, data3_de
data1content1-es, data2content1-es, data3content1-es, data1content1-de, data2content1-de, data3content1-de, data1content2-es, data2content2-es, data3content2-es, data1content2-de, data2content2-de, data3content2-de

Please help me with this query. There can be multiple language in future.

i[quote=“barbara1712, post:1, topic:212762, full:true”]There can be multiple language in future.

do not attempt to solve this with sql

instead, pull out what you want with the simplest query, then “pivot” using your front-end language (php or whatever)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.