MYSQL PROCEDURE LIMIT和OFFSET语法错误

时间:2016-08-11 09:45:18

标签: mysql function syntax limit

DROP PROCEDURE IF EXISTS `ft_job_search_filter_3`;
DELIMITER ;;
CREATE PROCEDURE `ft_job_search_filter_3`(IN param_city VARCHAR(255), param_company_slug VARCHAR(255), param_title VARCHAR(255), from_limit INT(5), to_limit INT(5))
BEGIN
    IF from_limit = '' THEN SET from_limit = 10; END IF;
    IF to_limit = '' THEN SET to_limit = 0; END IF;

    SELECT pj.ID, pj.job_title, pj.job_slug, pj.employer_ID, pj.company_ID, pj.job_description, pj.city, pj.dated, pj.last_date, pj.is_featured, pj.sts, pc.company_name, pc.company_logo, pc.company_slug, MATCH(pj.job_title, pj.job_description) AGAINST( param_title ) AS score
    FROM pp_post_jobs pj
    INNER JOIN pp_companies pc ON pc.ID = pj.company_ID 
    WHERE MATCH(pj.job_title, pj.job_description) AGAINST( param_title ) 
    AND pc.company_slug = param_company_slug    
    AND pj.city = param_city 
    AND pj.sts = 'active' 
    AND pc.sts = 'active'
    ORDER BY score DESC
    LIMIT from_limit, to_limit;

END
;;
DELIMITER ;

请求

[Err] 1064 - 您的SQL语法出错;检查与您的MySQL服务器版本相对应的手册,以便在' from_limit,to_limit附近使用正确的语法; END'第15行

0 个答案:

没有答案