Click here to Skip to main content
15,885,309 members
Home / Discussions / Database
   

Database

 
AnswerRe: Excel Spreadsheet To Database Migration Assistance Pin
Mycroft Holmes7-Apr-21 12:54
professionalMycroft Holmes7-Apr-21 12:54 
QuestionSQLite query Pin
David Crow23-Mar-21 10:02
David Crow23-Mar-21 10:02 
These two queries:
String sQuery1 = "SELECT * FROM service_schedules WHERE (vehicle_id,service_id) IN (SELECT DISTINCT vehicle_id,service_id FROM services_performed) AND vehicle_id=?";
Cursor cursor1 = db.rawQuery(sQuery1, new String[]{ String.valueOf(id) });

String sQuery2 = "SELECT * FROM service_schedules WHERE (vehicle_id,service_id) IN (SELECT DISTINCT vehicle_id,service_id FROM services_performed) AND vehicle_id="+id;
Cursor cursor2 = db.rawQuery(sQuery2, null);
only differ in how they handle the parameter at the end. For the second query, it compiles and executes fine. For the first query, the comma in the WHERE clause shows this error (in Android Studio):

'(', ')', '.', BETWEEN or IN expected, got ','

Even if I remove the AND condition altogether:
String sQuery3 = "SELECT * FROM service_schedules WHERE (vehicle_id,service_id) IN (SELECT DISTINCT vehicle_id,service_id FROM services_performed)";
Cursor cursor3 = db.rawQuery(sQuery3, null);
the error persists. Since there are two columns in the WHERE clause and two columns in the subquery, I don't understand the issue.

I also tried using aliases.

[edit]
I was able to use the third query in DB Browser for SQLite and it worked fine. That tells me that the syntax is correct and the problem is with how AS handles strings containing SQL queries.
[/edit]

Any ideas?

Thanks.
DC

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles



modified 23-Mar-21 16:27pm.

AnswerRe: SQLite query Pin
k505423-Mar-21 14:42
mvek505423-Mar-21 14:42 
GeneralRe: SQLite query Pin
David Crow23-Mar-21 16:10
David Crow23-Mar-21 16:10 
AnswerRe: SQLite query Pin
Richard Deeming23-Mar-21 23:31
mveRichard Deeming23-Mar-21 23:31 
GeneralRe: SQLite query Pin
David Crow24-Mar-21 3:16
David Crow24-Mar-21 3:16 
QuestionDisallowed implicit conversion from data type smalldatetime to data type float Pin
jkirkerx18-Mar-21 11:56
professionaljkirkerx18-Mar-21 11:56 
AnswerRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
Victor Nijegorodov18-Mar-21 21:15
Victor Nijegorodov18-Mar-21 21:15 
GeneralRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
jkirkerx19-Mar-21 6:58
professionaljkirkerx19-Mar-21 6:58 
GeneralRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
jsc4219-Mar-21 7:45
professionaljsc4219-Mar-21 7:45 
GeneralRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
jkirkerx19-Mar-21 8:54
professionaljkirkerx19-Mar-21 8:54 
GeneralRe: Disallowed implicit conversion from data type smalldatetime to data type float Pin
jsc4219-Mar-21 11:17
professionaljsc4219-Mar-21 11:17 
GeneralKearning Python Pin
Lumbeta Aquirok17-Mar-21 23:50
Lumbeta Aquirok17-Mar-21 23:50 
GeneralRe: Kearning Python Pin
Richard MacCutchan18-Mar-21 0:01
mveRichard MacCutchan18-Mar-21 0:01 
QuestionSystem.NullReferenceException: Pin
H. Martins23-Feb-21 14:28
H. Martins23-Feb-21 14:28 
AnswerRe: System.NullReferenceException: Pin
Richard MacCutchan23-Feb-21 22:04
mveRichard MacCutchan23-Feb-21 22:04 
GeneralRe: System.NullReferenceException: Pin
Richard Deeming23-Feb-21 22:19
mveRichard Deeming23-Feb-21 22:19 
GeneralRe: System.NullReferenceException: Pin
Richard MacCutchan23-Feb-21 22:31
mveRichard MacCutchan23-Feb-21 22:31 
QuestionGeneral advice about simple table storage. Pin
H. Martins19-Feb-21 9:34
H. Martins19-Feb-21 9:34 
AnswerRe: General advice about simple table storage. Pin
Eddy Vluggen20-Feb-21 7:04
professionalEddy Vluggen20-Feb-21 7:04 
GeneralRe: General advice about simple table storage. Pin
H. Martins21-Feb-21 3:26
H. Martins21-Feb-21 3:26 
GeneralRe: General advice about simple table storage. Pin
NotTodayYo12-Mar-21 7:17
NotTodayYo12-Mar-21 7:17 
GeneralRe: General advice about simple table storage. Pin
Eddy Vluggen13-Mar-21 6:09
professionalEddy Vluggen13-Mar-21 6:09 
QuestionWITSML Server And Client in C# Pin
Member 1332584614-Feb-21 21:54
Member 1332584614-Feb-21 21:54 
AnswerRe: WITSML Server And Client in C# Pin
Richard MacCutchan14-Feb-21 22:21
mveRichard MacCutchan14-Feb-21 22:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.