mysqli - MySQL Match column_name to Column data -


so trying work 2 (already) generated tables. in 1 table 1 there column named column_code in table 2 columns named data in column_code

per example table 1:

meta_data ---------------------------------- | pid         | 1                | | question    | favorite website | | column_code | aa123zz          | ----------------------------------  

where column_code has content named: 'aa123zz' , question called: favorite website

table 2:

content ----------------------------------- | id          | 4                 | | submit_date | 14-01-2013        | | aa123zz     | stackoverflow.com | ----------------------------------- 

the content of table_name aa123zz instance "stackoverflow.com"

now want query result like:

id: = 1 favorite website: stackoverflow.com 

so aa123zz stands question, have no other way of matching these together, how can this?

i sorry cannot make clearer. got these 2 tables , indeed seem missing something.

so try make bit clearer.

in content table table name aa123zz 'code' question.

the maker of database should have placed question column name in stead of code aa123zz. need match code inside meta_data.

so in meta_data in question_column can find: "favorite website" , in column_code find aa123zz.

in content table in aa123zz column find: stackoverflow.com

as can see cannot match these on inner join.

so there way match column_name 1 table contents of column in table?

you can't join tables column name variable. you're going need fix schema here, perhaps include foreign key value meta_data table content table , there can simple join on 2 tables.

read more on foreign keys


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -