zoukankan      html  css  js  c++  java
  • oracle字符串里面有通过逗号分隔的各个id,直接通过字符串获取id对应的name的字符串

    student表的courses字段,存着course的id,现在需要学生的所有课程用字符串的形式查出

    student表

    id name courses
    1 小明     44,55,66
    2 小红 11
    3 小紫 22,44

    course表

    id name
    11 数学
    22 语文
    66 英语
    44 体育
    55 美术

    查询sql

    select a.*,to_char(wm_concat(b.name)) from student a,course b  where instr(b.id, a.courses ) > 0

      

  • 相关阅读:
    codeforces
    hdu
    hdu
    poj 2823
    hdu
    hdu
    hdu
    微信公众号 SDK
    PHP 正则表达式
    注册和登录时的验证码
  • 原文地址:https://www.cnblogs.com/henuyuxiang/p/14989124.html
Copyright © 2011-2022 走看看