我正在使用这个 MYSQL 查询来拉回信息:
SELECT product_table.id, connector_table.id_two,
attribute_table.attribute, details_table.detail, det2.detail, det3.detail, det4.detail, det5.detail, det6.detail,att7.attribute,det7.detail
FROM `product_table`
LEFT JOIN connector_table ON product_table.id = connector_table.id_one
LEFT JOIN attribute_table ON connector_table.id_two = attribute_table.id
LEFT JOIN details_table ON connector_table.id_three = details_table.id
LEFT JOIN connector_table AS conn2 ON connector_table.id_one = conn2.id_one
LEFT JOIN details_table AS det2 ON conn2.id_three = det2.id
LEFT JOIN connector_table AS conn3 ON connector_table.id_one = conn3.id_one
LEFT JOIN details_table AS det3 ON conn3.id_three = det3.id
LEFT JOIN connector_table AS conn4 ON connector_table.id_one = conn4.id_one
LEFT JOIN details_table AS det4 ON conn4.id_three = det4.id
LEFT JOIN connector_table AS conn5 ON connector_table.id_one = conn5.id_one
LEFT JOIN details_table AS det5 ON conn5.id_three = det5.id
LEFT JOIN connector_table AS conn6 ON connector_table.id_one = conn6.id_one
LEFT JOIN details_table AS det6 ON conn6.id_three = det6.id
LEFT JOIN connector_table AS conn7 ON connector_table.id_one = conn7.id_one
LEFT JOIN details_table AS det7 ON conn7.id_three = det7.id
LEFT JOIN attribute_table as att7 ON conn7.id_two = att7.id
WHERE exported =0
AND product_table.id =2
AND connector_table.id_two = 130
AND conn2.id_two = 152
AND conn3.id_two = 129
AND conn4.id_two = 43
AND conn5.id_two = 49
AND conn6.id_two = 130
AND conn7.id_two = 41
这会在一行中提取我想要的信息,问题是任何属性(conn 别名)都可以具有多个相同的属性,因此它会打印到不止一行。
是否有任何动态方法允许查询拉回一行上的属性,即使它们具有多个属性?
谢谢