duanhaodi4809 2015-05-17 23:36
浏览 143

如何使用可点击链接id分组group_concat

Output:

//HotelID   //HotelName   //Operators 1,2,3

1    -       Nila    -    CleanX,Vey,Leo  

I want the operators to be individual clickable links , asigned to their IDs.

With GROUP_CONCAT they're all combine into one ID. I used LEFT JOIN in MYSQL

I Want it this way "this is just an example.Code wise it wont work"

Every id will be a link to click

//HotelID //HotelName //Operators 1,2,3
1    -     Nila   -  CleanX id1, Vey id2, Leo id3

Instead of all GROUP_CONCAT to one ID.

Is there a way since operators are GROUP_CONCAT in Mysql query to prevent duplication when echoed out.

Is there a way maybe to just GROUP but not GROUP_CONCAT Help please.

  • 写回答

1条回答 默认 最新

  • doucongmishang2385 2015-05-18 06:44
    关注

    Just use this query. The rest of your problem is about data display and user interface, all of which is best handled in application-level code (e.g. PHP).

    SELECT h.hotelID
         , h.hotelName 
         , o.opID
         , o.opName
      FROM hotels h
      LEFT 
      JOIN operators o
        ON o.opHotelID = h.hotelID 
     ORDER 
        BY h.hotelID
         , o.opID;
    
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)