Click here to Skip to main content
15,867,834 members
Home / Discussions / Database
   

Database

 
GeneralRe: Convert date, did I go too far Pin
Mycroft Holmes9-Apr-21 12:21
professionalMycroft Holmes9-Apr-21 12:21 
GeneralRe: Convert date, did I go too far Pin
jkirkerx9-Apr-21 14:20
professionaljkirkerx9-Apr-21 14:20 
GeneralRe: Convert date, did I go too far Pin
Richard Deeming11-Apr-21 21:10
mveRichard Deeming11-Apr-21 21:10 
AnswerRe: Convert date, did I go too far, Sort of solved Pin
jkirkerx10-Apr-21 14:06
professionaljkirkerx10-Apr-21 14:06 
QuestionExcel Spreadsheet To Database Migration Assistance Pin
Glen McHale6-Apr-21 23:55
Glen McHale6-Apr-21 23:55 
SuggestionRe: Excel Spreadsheet To Database Migration Assistance Pin
CHill607-Apr-21 0:57
mveCHill607-Apr-21 0:57 
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 

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.