php - Why does select into fail when I specify a second column name when creating an event in mySql? -
when creating event, why undeclared variable: votetype when add second column select sql? not possible specify second column in sql statement? what's right way this?
begin declare c varchar(2); declare velm int(10); declare vtype tinyint(1); select distinct(country) c votes; select votedelm velm, votetype vtype votes country = c; end
that's because into syntax in second case expecting variable array destination. it's seeing velm, votetype array of variables, since votetype hasn't been declared 1 (because it's 1 of columns), exception. try way instead:
select <columns> <variables> ... in case:
select votedelm, votetype velm, vtype votes country = c; there examples in mysql reference into.
Comments
Post a Comment