I know I am doing something wrong here but not really sure why the stored
procedure is failing with a declared variable as the field name
BEGIN
DECLARE boyah VARCHAR(32) DEFAULT 'section17';
SET boyah = 'section17';
SELECT
`translater`.`displayname` AS `displayname`,
`translater`.`scanname` AS `scanname`,
count(`consumables`.`section5`) AS `tcount`
FROM
(`translater` join `consumables` on((`consumables`.`section5` =
`translater`.`scanname`)))
WHERE
((`translater`.`company_id` = company_id) and (`translater`.`dgrup` <>
_utf8'2')
AND
(consumables.boyah BETWEEN nstart AND nstop)
AND
(`consumables`.`section16` >= 1)
AND
(`consumables`.`site_id` = site_id))
GROUP BY
`translater`.`ID`
ORDER BY
`translater`.`displayname`
DESC;
END
If I statically write it in the procedure works perfect, if I try to set a
variable and use that variable as the field name it fails.
Any suggestions???
| Thread |
|---|
| • Stored Procedure Problem. | admin | 3 May |