MySQL Prepared Statement - How to Loop Through

后端 未结 2 665
轻奢々
轻奢々 2021-01-25 05:38

I have a table filled with ID numbers, which I need to loop through, and use as variables in a prepared statement. I do not know if I need to use a stored procedure for this, o

2条回答
  •  情歌与酒
    2021-01-25 06:05

    Use a simple query like:

    SELECT *
    FROM data
    WHERE id IN (
        SELECT id
        FROM var_list
    )
    

提交回复
热议问题