Hi,
I'm writing a java application with JDBC, and have the following problem:
I have a table named TRIPS which has 4 columns:
ID
ISBACKPACK
ISFAMILY
DISCOUNT
the code which creates the table:
String sql = "CREATE TABLE IF NOT EXISTS TRIPS ( " +
"ID INT(2) PRIMARY KEY, " +
"ISBACKPACK BOOLEAN, " +
"ISFAMILY BOOLEAN, " +
"DISCOUNT INT(2)) ";
stmt.executeUpdate(sql);
I try to run the following query:
String tripIdSql = "SELECT ID FROM TRIPS " +
"WHERE ISBACKPACK IS " + true +
" AND ID > " + minId +
"LIMIT 1";
and get the "Unknown column ISBACKPACK on where clause
when I try running this query on the MySQL Workbench, it works perfectly...
I also tried to write "WHERE ISBACKPACK = TRUE " + "AND ID > " + minId
it also didn't work
Any ideas?
Thanks
I'm writing a java application with JDBC, and have the following problem:
I have a table named TRIPS which has 4 columns:
ID
ISBACKPACK
ISFAMILY
DISCOUNT
the code which creates the table:
String sql = "CREATE TABLE IF NOT EXISTS TRIPS ( " +
"ID INT(2) PRIMARY KEY, " +
"ISBACKPACK BOOLEAN, " +
"ISFAMILY BOOLEAN, " +
"DISCOUNT INT(2)) ";
stmt.executeUpdate(sql);
I try to run the following query:
String tripIdSql = "SELECT ID FROM TRIPS " +
"WHERE ISBACKPACK IS " + true +
" AND ID > " + minId +
"LIMIT 1";
and get the "Unknown column ISBACKPACK on where clause
when I try running this query on the MySQL Workbench, it works perfectly...
I also tried to write "WHERE ISBACKPACK = TRUE " + "AND ID > " + minId
it also didn't work
Any ideas?
Thanks