SQLite选择带列名称的查询

时间:2011-09-22 18:41:29

标签: android

 public Cursor getAcceptedTasks(String empID){
        return  database.rawQuery("select * from Assignments left join Tasks on Tasks._id = Assignments.TaskID left join Flights on Flights.ARR_FLT_ID = Tasks.ArrivalFlightID where Assignments.TaskAccepted='Y' and Assignments.AssignedTo=?", new String[]{ String.valueOf(empID) });
     }

这很完美。如果我提到列名而不是*,则会失败。我究竟做错了什么?

 public Cursor getAcceptedTasks(String empID){
        return  database.rawQuery("select Tasks.Aircraft, Tasks.Discrepancy, Flights.ARR_FLT from Assignments left join Tasks on Tasks._id = Assignments.TaskID left join Flights on Flights.ARR_FLT_ID = Tasks.ArrivalFlightID where Assignments.TaskAccepted='Y' and Assignments.AssignedTo=?", new String[]{ String.valueOf(empID) });
     }

0 个答案:

没有答案