0
난이 쿼리를 가지고 :안드로이드 모호한 열 이름
SELECT users.name, users.surname, users.pin, users.telephone, users.email, table_doctor_type.dr_type, table_doctor_title.dr_title FROM users join table_doctor_type on dr_type=table_doctor_type.id join table_doctor_title on title_id=table_doctor_title.id
내가이 오류를 얻을이 쿼리를 실행하려면 :
// TABLE USERS
private static final String TABLE_USERS = "users";
private static final String COLUMN_ID = "_id";
private static final String COLUMN_NAME = "name";
private static final String COLUMN_SURNAME = "surname";
private static final String COLUMN_PIN = "pin";
private static final String COLUMN_TITLE = "title";
private static final String COLUMN_DR_TYPE= "dr_type";
private static final String COLUMN_EMAIL= "email";
private static final String COLUMN_TEL= "telephone";
private static final String COLUMN_USER_TYPE= "u_type";
//TABLE DR TYPE
private static final String TABLE_DR_TYPE = "table_doctor_type";
private static final String DR_TYPE_COLUMN_ID = "id";
private static final String DR_TYPE_COLUMN_DR_TYPE = "dr_type";
// TABLE DOCTOR_TITLE
private static final String TABLE_DR_TITLE = "table_doctor_title";
private static final String DR_TITLE_COLUMN_ID = "id";
private static final String DR_TITLE_COLUMN_DR_TITLE = "dr_title";
private static final String CREATE_TABLE_DR_TYPE = "CREATE TABLE "
+ TABLE_DR_TYPE + "("
+ DR_TYPE_COLUMN_ID + " integer primary key, "
+ DR_TYPE_COLUMN_DR_TYPE + " text not null);";
private static final String CREATE_TABLE_DR_TITLE= "CREATE TABLE "
+ TABLE_DR_TITLE + "("
+ DR_TITLE_COLUMN_ID + " integer primary key, "
+ DR_TITLE_COLUMN_DR_TITLE + " text not null);";
private static final String CREATE_TABLE_USER = "CREATE TABLE "
+ TABLE_USERS + " ("
+ COLUMN_ID + " integer primary key autoincrement, "
+ COLUMN_NAME + " text not null, "
+ COLUMN_SURNAME + " text not null, "
+ COLUMN_TITLE + " integer, "
+ COLUMN_DR_TYPE + " integer, "
+ COLUMN_PIN + " text not null, "
+ COLUMN_EMAIL + " text not null, "
+ COLUMN_TEL + " text not null, "
+ COLUMN_USER_TYPE + " text not null, "
+ " FOREIGN KEY ("+COLUMN_TITLE+") REFERENCES "+TABLE_DR_TITLE+"("+DR_TITLE_COLUMN_ID+"), "
+ " FOREIGN KEY ("+COLUMN_DR_TYPE+") REFERENCES "+TABLE_DR_TYPE+"("+DR_TYPE_COLUMN_ID+") "
+");";
: 여기
Caused by: android.database.sqlite.SQLiteException: ambiguous column name: dr_type (code 1): , while compiling: SELECT users.name, users.surname, users.pin, users.telephone, users.email, table_doctor_type.dr_type, table_doctor_title.dr_title FROM users join table_doctor_type on dr_type=table_doctor_type.id join table_doctor_title on title_id=table_doctor_title.id
내 테이블입니다을 어떤 도움을 주시겠습니까?
시도'users.dr_type = table_doctor_type.id'에 table_doctor_type 가입 : 그래서, 같은 관심있는 특정
dr_type
열을 포함하는 테이블 이름으로dr_type
이름 앞에. – CommonsWare그게 정답 이었어, 아저씨, 올바른 것으로 확인해 볼 수 있도록 대답 해주세요. –