SQL("frdemo","SELECT a.bm FROM org_info a LEFT JOIN (SELECT bm, length(bm) len, dj FROM org_info WHERE 1=1 "+if(len(shi) == 0,"","and bm = '" +shi + "'") GROUP BY bm, dj) t1 ON 1 = 1 WHERE substr( a.bm, 1, len - 6 )= substr( t1.bm, 1, len - 6 )) ",1)
Z4u3z1 回复 123木头人1(提问者)SQL(\"frdemo\",\"SELECT a.bm FROM org_info a LEFT JOIN (SELECT bm, length(bm) len, dj FROM org_info WHERE 1=1 \"+if(len(shi) == 0,\" GROUP BY bm, dj\",\"and bm = \'\" +shi + \"\' GROUP BY bm, dj\")+\") t1 ON 1 = 1 WHERE substr( a.bm, 1, len - 6 )= substr( t1.bm, 1, len - 6 )\",1) 斜杠是系统自己加的,请删除
SQL("frdemo","SELECT a.bm FROM org_info a LEFT JOIN (SELECT bm, length(bm) len, dj FROM org_info WHERE 1=1 "+if(len(shi) == 0,"","and bm = '" +shi + "'")+"GROUP BY bm, dj) t1 ON 1 = 1 WHERE substr( a.bm, 1, len - 6 )= substr( t1.bm, 1, len - 6 ))",1)
123木头人1(提问者) 回复 snrtuemcSQL(\"frdemo\",\"SELECT a.bm FROM org_info a LEFT JOIN (SELECT bm, length(bm) len, dj FROM org_info WHERE 1=1 \"+if(len(shi) == 0,\"\",\"and bm = \'\" +shi + \"\'\") GROUP BY bm, dj) t1 ON 1 = 1 WHERE substr( a.bm, 1, len - 6 )= substr( t1.bm, 1, len - 6 )) \",1)