How can I loop through all rows of a table? (MySQL)

后端 未结 5 1072
情深已故
情深已故 2020-11-27 10:56

I have a table A and there is one primary key ID.

Now I want to go through all rows in A.

I found something like \'for each record in A\', but this seems to

5条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 11:47

    Mr Purple's example I used in mysql trigger like that,

    begin
    DECLARE n INT DEFAULT 0;
    DECLARE i INT DEFAULT 0;
    Select COUNT(*) from user where deleted_at is null INTO n;
    SET i=0;
    WHILE i

提交回复
热议问题