首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

写一个sql文,取包含有某个字符串的所有字段,详见上文

2012-10-12 
写一个sql文,取包含有某个字符串的所有字段,详见下文SELECTorganization_.treePath ,FROMorganization_WHE

写一个sql文,取包含有某个字符串的所有字段,详见下文
SELECTorganization_.treePath ,
FROMorganization_
 WHERE organization_.treePath 
LIKE('%10001%')
要取出所有的包含organizationId的treepath,现在我的organizationId定的死值10001
取organizationId的sql文如下:
SELECT organizationId
FROMorganization_
  INNER JOIN expandovalue
INNER JOIN expandocolumn
WHERE expandovalue.classPK = organization_.organizationId
  AND expandovalue.columnId = expandocolumn.columnId
  AND expandocolumn.`name` = 'client-id'

现在不能将下面的sql文替换上面的like部分,求大侠帮忙,再线等

[解决办法]
试试看:

SQL code
SELECT s.treePath FROM organization_  s INNER JOIN (SELECT ss.organizationIdFROM organization_ ssINNER JOIN expandovalue INNER JOIN expandocolumn WHERE expandovalue.classPK = ss.organizationId AND expandovalue.columnId = expandocolumn.columnId AND expandocolumn.`name` = 'client-id' ) temp  ON INSTR(s.treePath,temp.organizationId)>0 

热点排行