In my database, there are two tables,
1) Task : (id (INTEGER + PRIMARY_KEY), title, description, timestamp, category_id(Foreign key of Category -> id ))
2) Category : (id (INTEGER + PRIMARY_KEY), name)
To select data from a table Anko is providing a method like :
var mDatabase: DatabaseManager = DatabaseManager.getInstance(activity)
var mResult: List<TaskModel> = ArrayList()
mDatabase.use {
mResult = select(TABLE_TASK).parseList(classParser())
}
What I want is to show list of task with its category name I have checked all the tutorials and stack links but didn't get any way to achieve this.
Is there any way to select data from two tables in Kotlin Anko?
Thanks is Advance!
it's late but can be useful for someone like myself
the answer in short is ,Yes
you should create a data class including join column data variables like this:
and use inner join in select command
that's it