0

I have a Users table that has an element called "date". I would like to make these pseudocode queries work in Java:

select * from Users WHERE date=today

and also

select * from Users WHERE date "in this hour"

How can I write the queries?

I am using Google App Engine, and the date was initially created using java.util.Date.

Please help. Thanks

Thilo
  • 257,207
  • 101
  • 511
  • 656
chris
  • 20,791
  • 29
  • 77
  • 90

2 Answers2

1

Since a date in GoogleAppEngine specifies time down to the millisecond using "=" will not likely work.

It appears you could do something like the following:

select from Users where date >= midnightWesnesday
                      && date < midnightThusday;

You should also be able to specify the correct range for the hour accordingly.

Jay Askren
  • 10,282
  • 14
  • 53
  • 75
0
PreparedStatement st = conn.prepareStatement("select * from Users where date = ?");
st.setDate(1, new java.sql.Date(System.currentMillis());
ResultSet rs = st.executeQuery();

jiql is a Java JDBC wrapper for Cloud computing databases. The database is accessed via the jiql jdbc client. The data is actually stored in a cloud-based data store, such as Google's BigTable.

http://www.jiql.org/xwiki/bin/view/Main/

jspcal
  • 50,847
  • 7
  • 72
  • 76