conyo 2015-07-23 06:15 采纳率: 100%
浏览 1502
已采纳

sql语句的写法要怎么样写才能达到

表a有字段id,p1,p2,p3,p4.......,表b有字段id,m

a表数据, b表数据
111, 1,2,3,4........ 1,红
2,黄
3,蓝
4,白
a.p1=b.m,a.p2=b.m

想查询出
111,红,2,黄,3,蓝,4,白 等方式语句如何写

  • 写回答

6条回答 默认 最新

  • 丵鹰 2015-07-23 15:10
    关注

    111,红,2,黄,3,蓝,4,白 等方式语句如何写
    select a.id,(select m from b where b.id=a.p1),a.p1,(select m from b where b.id=a.p2),a.p2,(select m from b where b.id=a.p3),a.p3,(select m from b where b.id=a.p4),a.p4 from a

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?