Incorrect parameter count in the call to native function 'SUBSTRING_INDEX'

 Error occurs due to silly mistake at time of writing MYSQL query.

Example :

SELECT SUM(CASE (SUBSTRING_INDEX((SUBSTRING_INDEX(t1.column,'#',t3.column_NO),'#',-1))) WHEN 'l' THEN 1 ELSE 0 END ) AS LEF,SUM(CASE (SUBSTRING_INDEX((SUBSTRING_INDEX(t1.column,'#',t3.column_NO),'#',-1))) WHEN 'r' THEN 1 ELSE 0 END ) AS RIGH, SUM(CASE (SUBSTRING_INDEX((SUBSTRING_INDEX(t1.column,'#',t3.column_NO),'#',-1))) WHEN 'w' THEN 1 ELSE 0 END ) AS WRONG  FROM table1 t1 LEFT JOIN table2 t2 ON t1.ID=t2.ID LEFT JOIN table3 t3 ON RE.column_ID=t3.column_ID WHERE t1.TEST_ID=610 AND t2.column1_ID=341 AND t3.column_NO=1;

Note : Error in above query is some extra brackets.

SUM(CASE (SUBSTRING_INDEX((SUBSTRING_INDEX(t1.column,'#',t3.column_NO),'#',-1))) WHEN 'l' THEN 1 ELSE 0 END ) AS LEF


Share on Google Plus

About Bittu choudhary

A Software Engineer and SEO Expert.Self-Employed and Making Money through google.