Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在sql中使用组concat连接三个表_Php_Mysql_Sql_Json_Join - Fatal编程技术网

Php 如何在sql中使用组concat连接三个表

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

我试图用组concat连接三个表。问题是主表的连接列是json格式的

查询正在工作,但一次又一次地重复连接列数据 查询->

表格->


在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]