I’m querying a table that does not have an index and the javascript grid I use requires an index for some reason. What’s the easiest way to just return an incrementing value in one of the columns of the result set?
SELECT
[function to create incrementing value for each record] as id
, name
, email
FROM users
ORDER BY name
I may have answered my own question. This seems to work:
SET @rowcount =0;
SELECT
@rowcount := @rowcount +1 AS id
, name
, email
FROM users
ORDER BY name
That isn’t an index. I think you mean a counter.
An index applies to a certain column or group of columns and relates to speeding searches on that column or group of columns.
Don’t want you or others to confuse the terminology.