Thanks for the Reply Geoffery. The join key I am getting from the select from another table (iris_subset)
DELIMITER //
CREATE PROCEDURE GetSameRecords()
READS SQL DATA
BEGIN
DECLARE next_subset VARCHAR(75);
select subset INTO next_subset FROM iris_subset where id = 1;
set @s = “select count(*) from iris_setosa inner join iris_versicolor using (next_subset)”;
PREPARE stmt1 FROM @s;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
END //
DELIMITER ;
but when I call that procedure, I get the error:
ERROR 1054 (42S22): Unknown column ‘next_subset’ in ‘from clause’
Thanks.

