Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

Unknown column in where clause (no replies)

$
0
0
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

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>