我有 3 个包含几个字段的 mysql 表。请参考以下
-------- -------- --------
table 1 | table 2 | table 3
-------- -------- --------
a_id | b_id | email
| a_id
name | status | b_id
email_1 | date | name
phone | ref | phone
address | email_2 | address
state | from | state
| status
| date
| ref
| from
email_1和email_2完全相同。
我需要用所有 table1 和 table2 数据填充 table3 字段。但我需要根据电子邮件将它们存储在一行中。所以它们看起来像下面这样:
=================================================================================
table 3
=================================================================================
email | a_id | b_id | name | phone | address | state | status | date | ref | from
------+------+------+------+-------+---------+-------+--------+------+-----+-----
a@x.co| 9 | 112 | John | 999 | xxxx | NY | 0 | 15Jue| dave| y
------+------+------+------+-------+---------+-------+--------+------+-----+-----
b@x.co| 6 | 338 | Sue | 909 | xxxx | NY | 1 | 12Jue| kell| z
------+------+------+------+-------+---------+-------+--------+------+-----+-----
c@x.co| 3 | 152 | John | 679 | xxxx | NY | 1 | 10Jue| lois| g
------+------+------+------+-------+---------+-------+--------+------+-----+-----
d@x.co| 8 | 145 | John | 599 | xxxx | NY | 0 | 8Jue | sue | f
我不知道该怎么做。我正在使用核心 php,mysql。请问有什么帮助吗?
谢谢!