I am running a query using SQL embedded in Java. I have three tables in my database, QUERY, G1, and G2. All of them have the same schema of (SETID, GENEID).
The query I am running is as follows:
SELECT q.SETID, COUNT(q.SETID), g1.SETID, COUNT(g1.SETID)
FROM QUERY AS q
INNER JOIN G1 AS g1 ON q.GENEID = g1.GENEID
GROUP BY q.SETID, g1.SETID
Partial code for execution:
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
con = DriverManager.getConnection(url, user, password);
stmt = con.createStatement();
String sql = "SELECT q.SETID, COUNT(q.SETID) AS QSIZE, g1.SETID, COUNT(g1.SETID) AS GSIZE FROM QUERY AS q INNER JOIN G1 AS g1 ON q.GENEID = g1.GENEID GROUP BY q.SETID, g1.SETID";
rs = stmt.executeQuery(sql);
rsmd = rs.getMetaData();
When I run this, it throws the following error: ORA-00933: SQL command not properly ended. Could anyone please help me with this error?
Thanks!