如何将以下mysql查询转换为laravel查询构建器

时间:2016-02-08 10:16:20

标签: laravel laravel-query-builder

SELECT SQL_CALC_FOUND_ROWS *       FROM(             (SELECT 1 AS orderField,                 MEM。fname,                 MEM。lname,                 MEM。profilenam,                 MEM。mem_id,                 MEM。photo,                 MEM。ethnicity,                 MEM。profile_type,                 MEM。gender,                 MEM。verified,                 MEM。deleted            来自会员AS mem            INNER JOIN网络AS net ON net.frd_id = mem.mem_id            在哪里net.mem_id ='1728'            AND(mem。profilenam LIKE'%abc%'                 或lname LIKE'abc%'                 或者CONCAT(fname,'',lname)LIKE'abc%')          )         联盟         (SELECT 2 AS orderField,                 fname,                 lname,                 profilenam,                 mem_id,                 photo,                 ethnicity,                 profile_type,                 gender,                 verified,                 deleted          来自members          WHERE(profilenam LIKE'%abc%'                 或lname LIKE'abc%'                 或者CONCAT(fname,'',lname)LIKE'abc%')        )      )AS t      在哪里t.verified ='Y'      AND t。mem_id NOT IN(1,2,3,4,5,1728)      AND t。deleted ='N'      GROUP BY t.mem_id      ORDER BY t.orderField,t.profilenam DESC 0,50

1 个答案:

答案 0 :(得分:0)

QueryBuilders.queryStringQuery(escapeSpecialCharacters("error)"));

String escapeSpecialCharacters(String str) {

   str.replaceAll(/[^\sa-zA-Z0-9]/, "\\'");
}