I have read many answers on this question but I still can not solve the problem :(
These are my tables.
public static final String DATABASE_NAME = "EventBoard.db";
public static final String EVENTS_TABLE = "Events";
public static final String GUESTS_TABLE = "Guests";
public static final String LINKER_TABLE = "Linker";
These are their fields.
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table " + EVENTS_TABLE + "( _id INTEGER PRIMARY KEY AUTOINCREMENT,Name TEXT,Time TEXT,Date TEXT,Venue TEXT,Contact TEXT,Description TEXT);");
db.execSQL("create table " + GUESTS_TABLE + "( _id INTEGER PRIMARY KEY AUTOINCREMENT,Name TEXT,Phone TEXT unique);");
db.execSQL("create table " + LINKER_TABLE + "( _id INTEGER PRIMARY KEY AUTOINCREMENT,Guests TEXT);");
}
What I want to do is get all the guests from name column in my guest table to the Guests column in my Linker Table. I have read a lot of other similar questions but it simply did not work. The Linker table will allow me to form a table between Guests(as rows) and Events(as columns) so I can store a guest list for each event.
public void updateLinkerTable(){
SQLiteDatabase db = this.getWritableDatabase();
db.rawQuery("",null);
}
Above is how I am sending a query to the database. Any help would be appreciated. I'm stuck on this problem since 2 days now.
INSERT INTO Linker (Guests) SELECT Name FROM Guests
When I run this SQL Query in my SQLite Manager Mozilla Plugin it runs fine and brings all the names from Guests table to Guests in Linker table..But when I run the same query in my Android code it does not work and I dont even get any error related to it.