加入时不要重复MySQL父表值

时间:2016-03-08 06:45:49

标签: mysql

我有来自MySQL的以下输出。

| 345     | 2016-02-11      | 2016-02-11  | 2016-02-11    | goods desc  |               | NULL    | NULL         |    NULL | NULL  | NULL   |
| 545     | 2016-02-02      | 2016-02-01  | 2016-02-01    | Goods desc  | 15            | 444     | 555          | 90.0000 | 60    | 1      |
| 545     | 2016-02-02      | 2016-02-01  | 2016-02-01    | Goods desc  | 15            | 123     | 123          | 80.8800 | 78.85 | 0.14   |
| 545     | 2016-02-02      | 2016-02-01  | 2016-02-01    | Goods desc  | 16            | NULL    | NULL         |    NULL | NULL  | NULL   |
| 545     | 2016-02-02      | 2016-02-01  | 2016-02-01    | Goods desc  | 17            | NULL    | NULL         |    NULL | NULL  | NULL   |
| 545     | 2016-02-10      | 2016-02-01  | 2016-02-01    | Goods desc  |               | NULL    | NULL         |    NULL | NULL  | NULL   |
+---------+-----------------+-------------+---------------+-------------+---------------+---------+--------------+---------+-------+--------+

如果已经显示来自父表的行数据,那么它不应该与子表的后续匹配重复。我如何实现这一目标?

| 345     | 2016-02-11      | 2016-02-11  | 2016-02-11    | goods desc  |               |         |              |         |       |        |
| 545     | 2016-02-02      | 2016-02-01  | 2016-02-01    | Goods desc  | 15            | 444     | 555          | 90.0000 | 60    | 1      |
|         |                 |             |               |             |               | 123     | 123          | 80.8800 | 78.85 | 0.14   |
|         |                 |             |               |             | 16            |         |              |         |       |        |
|         |                 |             |               |             | 17            |         |              |         |       |        |
| 545     | 2016-02-10      | 2016-02-01  | 2016-02-01    | Goods desc  |               |         |              |         |       |        |
+---------+-----------------+-------------+---------------+-------------+---------------+---------+--------------+---------+-------+--------+

0 个答案:

没有答案