java - Why is sql command not properly ended being thrown? -



java - Why is sql command not properly ended being thrown? -

i running query using sql embedded in java. have 3 tables in database, query, g1, , g2. of them have same schema of (setid, geneid).

the query running follows:

select q.setid, count(q.setid), g1.setid, count(g1.setid) query q inner bring together g1 g1 on q.geneid = g1.geneid grouping q.setid, g1.setid

partial code execution:

drivermanager.registerdriver(new oracle.jdbc.oracledriver()); con = drivermanager.getconnection(url, user, password); stmt = con.createstatement(); string sql = "select q.setid, count(q.setid) qsize, g1.setid, count(g1.setid) gsize query q inner bring together g1 g1 on q.geneid = g1.geneid grouping q.setid, g1.setid"; rs = stmt.executequery(sql); rsmd = rs.getmetadata();

when run this, throws next error: ora-00933: sql command not ended. please help me error?

thanks!

try to:

escape table name query - looks reserved word add aliases count() columns - illustration count(q.setid) q_cnt add semi-colon @ end remove table aliases @harvey suggested select q.setid, count(q.setid) q_cnt, g1.setid, count(g1.setid) g1_cnt `query` q inner bring together g1 g1 on q.geneid = g1.geneid grouping q.setid, g1.setid; select query.setid, count(query.setid) q_cnt, g1.setid, count(g1.setid) g1_cnt query inner bring together g1 on query.geneid = g1.geneid grouping query.setid, g1.setid;

java mysql sql command syntax-error

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -