let's say I have the next query:
SELECT UNIX_TIMESTAMP(Logins.FechaLogin) FROM GA.Logins WHERE Logins.IdEmpleado = ? AND UNIX_TIMESTAMP(Logins.FechaLogin) >= UNIX_TIMESTAMP(?) AND UNIX_TIMESTAMP(Logins.FechaLogin) <= UNIX_TIMESTAMP(?)
And I want something like:
Date = UNIX_TIMESTAMP(Logins.FechaLogin);
SELECT UNIX_TIMESTAMP(Logins.FechaLogin) FROM GA.Logins WHERE Logins.IdEmpleado = ? AND Date >= UNIX_TIMESTAMP(?) AND Date <= UNIX_TIMESTAMP(?)
stmt.setInt(1, EmployeeId);
stmt.setString(2, Date1);
stmt.setString(3, Date2);
All into a Prepared Statement (JDBC prepareStatement()), is there a way I could do something like this in order to avoid redundance into the query? or is this something useless? by the way I think it has to pass the UNIX_TIMESTAMP function in each SELECT iteration if I'm correct.
Thank's!
FechaLogincolumn? Isn't "d >= t AND d <= t" the same thing as "d = t"?