Prefix Database tables columns names with table name ?
Table User: -Id -Name etc.
Table User: -UserId -UserName etc.
While doing join query requests, when querying fields with the same name in different tables, we need to put aliases
If i do : "SELECT User.id, Image.id FROM User INNER JOIN Image" i won't be able to get the fields back. (Cursor.get("User.id") crash => can't prefix with table name)
#1Updated by Mickael G. about 7 years ago
use alias...you can use :
- column ("id")
- table.column ("user.id")
- alias ("user_id")
- SELECT user.id as user_id FROM user
#5Updated by Gregg C. almost 7 years ago
Using aliases can be really messy, as in AskNChat : https://git.tactfactory.com/ask-n-chat/ask-n-chat-android/blob/master/src/com/tactfactory/asknchat/provider/DiscussionProviderAdapter.java