Php 我可以在mysql select查询中使用一个表字段值作为第二个表字段名吗?

Php 我可以在mysql select查询中使用一个表字段值作为第二个表字段名吗?,php,sql,database,postgresql,codeigniter,Php,Sql,Database,Postgresql,Codeigniter,情景: 名为testtable的表1的字段名 id、名称、大小、宽度、高度 表2的字段名命名为errortable id,描述,字段1,字段2,操作员 errortable的值 有可能这样做吗 当前查询: 选择desc,选择count*作为testtable中的总错误,其中errortable.field1 errortable.operator errortable.field2来自errortable group by id谢谢所有发表评论的人,我在你们的评论中得到了我的答案,并通过使用ph

情景:

名为testtable的表1的字段名

id、名称、大小、宽度、高度

表2的字段名命名为errortable

id,描述,字段1,字段2,操作员

errortable的值

有可能这样做吗

当前查询:


选择desc,选择count*作为testtable中的总错误,其中errortable.field1 errortable.operator errortable.field2来自errortable group by id

谢谢所有发表评论的人,我在你们的评论中得到了我的答案,并通过使用php中的一些代码实现了这个场景。

MySQL或Postgeslq?不要标记未涉及的产品…任何人,我都需要它们被称为关系数据库的原因是因为它们都是关于表之间的关系,但这两个表之间没有关系关系是不可能的,我有一个错误列表,我想检查另一个表中存在的许多错误,就是这样,不,因为您试图使用字段值作为字段名,而我想不出在MySQL中实现这一点的方法。
+----+-------------------------------------+--------+--------+----------+
| id |                desc                 | field1 | field2 | operator |
+----+-------------------------------------+--------+--------+----------+
|  1 | size should not greater than width  | size   | width  | >        |
|  2 | size should not greater than height | size   | height | >        |
|  3 | with should be equal to height      | width  | height | <>       |
+----+-------------------------------------+--------+--------+----------+
+-------------------------------------+-------+
|              errorname              | count |
+-------------------------------------+-------+
| size should not greater than width  |     6 |
| size should not greater than height |     2 |
| with should be equal to height      |     3 |
+-------------------------------------+-------+