我需要获取重复数据的空字段
例如一个客户可以有两个或多个联系人,所以查询返回(只是短了qyery resul):
客户名称| CONTACT_PERSON|ETC..
dell | Ighor |etc..
dell | Dima |etc..
但我需要: CUSTOMER_NAME| CONTACT_PERSON|等等...
dell | Ighor |etc..
NULL | Dima |etc..
SELECT
`contact`.*,
`branch_has_equipment`.*,
`branch_has_contact`.*,
`equipment`.*,
`customer_has_branch`.*,
`branch`.*,
`customer`.*,
`ip`.*
FROM `customer`
INNER JOIN `customer_has_branch`
ON `customer`.`customer_id` = `customer_has_branch`.`customer_id`
INNER JOIN `branch`
ON `customer_has_branch`.`branch_id` = `branch`.`branch_id`
INNER JOIN `branch_has_equipment`
ON `branch`.`branch_id` = `branch_has_equipment`.`branch_id`
INNER JOIN `equipment`
ON `branch_has_equipment`.`equipment_id` = `equipment`.`equipment_id`
INNER JOIN `branch_has_contact`
ON `branch`.`branch_id` = `branch_has_contact`.`branch_id`
INNER JOIN `contact`
ON `branch_has_contact`.`contact_id` = `contact`.`contact_id`
INNER JOIN `equipment_has_ip`
ON `equipment`.`equipment_id` = `equipment_has_ip`.`equipment_id`
INNER JOIN `ip`
ON `equipment_has_ip`.`equipment_id` = `ip`.`ip_id`
WHERE `customer`.`inservice` = 'Yes'
ORDER BY `customer`.`customer_name`
另外,表格^
顾客
customer_id customer_name inservice service_type 评论
分支
branch_id 城市地址
设备
设备_id 品牌型号 连接参数 连接类型 序列号 id 发布
接触
联系人_id 姓名 姓 电话_手机_工作电话_其他职位
customer_has_branch_id customer_id branch_id