SELECT文の結果に No. (1,2,3,4,・・・)のような連番を振りたい時は、
以下のようなプログラムを組むとできる。
$this->db->query("set @num:= 0");
$sql ="
SELECT
@num:= @num + 1 AS No,
area_id
・・・・
";
$this->db->query($sql);
Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 5 years have passed since last update.
SELECT文の結果に No. (1,2,3,4,・・・)のような連番を振りたい時は、
以下のようなプログラムを組むとできる。
$this->db->query("set @num:= 0");
$sql ="
SELECT
@num:= @num + 1 AS No,
area_id
・・・・
";
$this->db->query($sql);
Register as a new user and use Qiita more conveniently
Go to list of users who liked