• 请不要在回答技术问题时复制粘贴 AI 生成的内容
qwa123
V2EX  ›  程序员

请求给位大佬帮我看看该怎么写这条 sql

  •  
  •   qwa123 · Feb 16, 2019 · 1945 views
    This topic created in 2667 days ago, the information mentioned may be changed or developed.

    现有表结构及数据(mysql 数据库)

    |id | type | bizId | batchId| |-----|-----|-----|-----| |1 | 1 | uid1 |1| |2 | 1 | uid2 | 1| |3 | 2 | fid1 | 1| |4 | 2 | fid2 | 1| |5 | 1 | uid3 | 2| |6 | 2 | fid3 | 3|

    bizId 根据 type 的不同而代表不同的业务含义 type 为 1 的时候 bizId 为用户 id type 为 2 的时候 bizId 为文件 id

    期望查询结果 |batchId | uid | fid| |-----|-----|-----| |1 | uid1,uid2 | fid1,fid2| |2 | uid3| | |3 | |fid3|

    qwa123
        1
    qwa123  
    OP
       Feb 16, 2019
    格式,不对,帖子也没法删,重新发了一个帖子
    https://www.v2ex.com/t/535679
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2837 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 02:45 · PVG 10:45 · LAX 19:45 · JFK 22:45
    ♥ Do have faith in what you're doing.