
March 19th, 2005, 07:16 AM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 25
Time spent in forums: 4 h 31 m 27 sec
Reputation Power: 0
|
|
|
Problem with Dates
hi all ! I have this code. That should show me all th dates from a date.
What I want is that when the quey comes it should be ordered by Tipo
that its a charvar and Date wich is date type. BUt its not doing either of
both.
Can you help me out ?
Code:
public ResultSet busquedaCitas2(java.sql.Date fecha_cita)
throws SQLException
{ //falta un group by
System.out.println(fecha_cita);
System.out.println("Entro en busquedaCitas2");
String sql = "Select*,paciente.Nombres,paciente.Apellidos,pacien te.Prescriptor,paciente.Mutua,sesiones.Sesigast,se siones.Sesifaltantes,protocolo.Tipo FROM citas, paciente,sesiones,protocolo WHERE citas.Fecha=? AND paciente.DNI=citas.DNI AND paciente.DNI=sesiones.DNI AND sesiones.Protocolo=citas.Protocolo AND citas.Protocolo=protocolo.Nombre ORDER BY citas.Hora DESC,protocolo.Tipo";
PreparedStatement pstmt = conexion.prepareStatement(sql);
pstmt.setDate(1,fecha_cita);
cdr=pstmt.executeQuery();
return cdr;
}
Thanks!
|