I'm converting an application that runs currently under MYSQL to use SQL Server. The upshot is, that I have an odd situation! The existing query works in MySQL via JDBC, and works inside MySQL as a command line query -- yet, the same query is not working via the SQL Server JDBC driver, despite working inside the SQL Server studio from the command line as a query.
Under MYSQL JDBC I get a set of results, under SQL Server JDBC I get 0 results.
I've tried the query this way (which works in SQL Server from the command line)
SELECT DISTINCT
x,
y
FROM
table1,
table2
WHERE
x = y
AND start_date <= '2015-05-15'
AND end_date >= '2015-05-15'
AND direction LIKE 'Direction';
which inside JDBC looks like this:
"select DISTINCT x, y from table1, table2" +
"WHERE x=y and start_date <= ? and end_date >= ? and direction like ?"