Php 如何在sql中使用组concat连接三个表
我试图用组concat连接三个表。问题是主表的连接列是json格式的 查询正在工作,但一次又一次地重复连接列数据 查询-> 表格->Php 如何在sql中使用组concat连接三个表,php,mysql,sql,json,join,Php,Mysql,Sql,Json,Join,我试图用组concat连接三个表。问题是主表的连接列是json格式的 查询正在工作,但一次又一次地重复连接列数据 查询-> 表格-> 在GROUP\u CONCAT函数中使用DISTINCT关键字 即: 在GROUP_CONCAT函数中使用DISTINCT关键字 即: 在组连接时,执行Distinct检查 [SELECT tour_package.description AS description, tour_package.NAME AS NAME, GROUP_CONCAT( DISTI
在GROUP\u CONCAT函数中使用DISTINCT关键字 即:
在GROUP_CONCAT函数中使用DISTINCT关键字 即:
在组连接时,执行
Distinct
检查
[SELECT tour_package.description AS description, tour_package.NAME AS NAME, GROUP_CONCAT( DISTINCT(destination_continent.NAME) ) AS continent_name, GROUP_CONCAT( DISTINCT(travel_style.NAME) ) AS travel_style_name, tour_package.id AS id, tour_package.img_path_thumb AS img_path_thumb, tour_package.continent_id, tour_package.travel_style_id FROM tour_package LEFT JOIN destination_continent ON FIND_IN_SET( destination_continent.id, REPLACE( REPLACE( REPLACE( tour_package.continent_id, '\[', '' ) , '\]', '' ) , '\"', '' ) ) LEFT JOIN travel_style ON FIND_IN_SET( travel_style.id, REPLACE( REPLACE( REPLACE( tour_package.travel_style_id, '\[', '' ) , '\]', '' ) , '\"', '' ) ) WHERE `tour_package`.`DELETE` =0 && `destination_continent`.`DELETE` =0 LIMIT 0 , 30][1]
在组连接时,执行
Distinct
检查
[SELECT tour_package.description AS description, tour_package.NAME AS NAME, GROUP_CONCAT( DISTINCT(destination_continent.NAME) ) AS continent_name, GROUP_CONCAT( DISTINCT(travel_style.NAME) ) AS travel_style_name, tour_package.id AS id, tour_package.img_path_thumb AS img_path_thumb, tour_package.continent_id, tour_package.travel_style_id FROM tour_package LEFT JOIN destination_continent ON FIND_IN_SET( destination_continent.id, REPLACE( REPLACE( REPLACE( tour_package.continent_id, '\[', '' ) , '\]', '' ) , '\"', '' ) ) LEFT JOIN travel_style ON FIND_IN_SET( travel_style.id, REPLACE( REPLACE( REPLACE( tour_package.travel_style_id, '\[', '' ) , '\]', '' ) , '\"', '' ) ) WHERE `tour_package`.`DELETE` =0 && `destination_continent`.`DELETE` =0 LIMIT 0 , 30][1]
thnx,现在我在自我解嘲,我必须吃一片补品来记忆thnx,现在我在自我解嘲,我必须吃一片补品来记忆
[SELECT tour_package.description AS description, tour_package.NAME AS NAME, GROUP_CONCAT( DISTINCT(destination_continent.NAME) ) AS continent_name, GROUP_CONCAT( DISTINCT(travel_style.NAME) ) AS travel_style_name, tour_package.id AS id, tour_package.img_path_thumb AS img_path_thumb, tour_package.continent_id, tour_package.travel_style_id FROM tour_package LEFT JOIN destination_continent ON FIND_IN_SET( destination_continent.id, REPLACE( REPLACE( REPLACE( tour_package.continent_id, '\[', '' ) , '\]', '' ) , '\"', '' ) ) LEFT JOIN travel_style ON FIND_IN_SET( travel_style.id, REPLACE( REPLACE( REPLACE( tour_package.travel_style_id, '\[', '' ) , '\]', '' ) , '\"', '' ) ) WHERE `tour_package`.`DELETE` =0 && `destination_continent`.`DELETE` =0 LIMIT 0 , 30][1]