For below tables:
create table professor {id varchar(255), first_name varchar(255), last_name varchar(255) };
create table student {id varchar(255), first_name varchar(255), last_name varchar(255) };
Suppose you have below query:
select professor.first_name, professor.last_name from professor
union
select student.first_name, student.last_name from student;
and suppose you need to use the resulting cursor in a ListView that uses a CursorAdapter. It is stated in the documentation that:
The Cursor must include a column named "_id" or this class will not work. Additionally, using MergeCursor with this class will not work if the merged Cursors have overlapping values in their "_id" columns.
How would you generate a unique _id
column value of type long
for each of the rows in the resulting cursor?