Thanks so much for helping, but it doesn't quite do what I want. When I run this:
select localSymbol, max(localDate2) from tre_xignite where localDate2<'2013-07-02' group by localSymbol order by max(localdate2) The is one of the rows that is returned: AAPL 2013-07-01 00:00:00.0 But when I run the following, it shows that there is a row for "2013-07-02" select max(localdate2) from tre_xignite where localsymbol='AAPL' 2013-07-02 00:00:00.0 As should be obvious, this is stock market data. I want the query to return only the results where the max date is less that 2013-07-02. In other words, your query is returning a row for every symbol, not just the ones that haven't been updated. Have any thoughts? I tried this, but it doesn't run: select localSymbol, max(localDate2) from tre_xignite where max(localDate2) <'2013-07-02' group by localSymbol order by max(localdate2) On Tuesday, July 2, 2013 9:51:17 PM UTC-7, TrendTimer.com wrote: > > Hello, perhaps someone can help. I was delighted when the following query > returned a nearly instant result using mysql: > > > select localSymbol, max(localDate2) from trendtim_trendtimer.tre_xignite > where localDate2<'2013-07-02' group by localSymbol > order by localdate2 > > I was expecting the following error: > Column "LOCALDATE2" must be in the GROUP BY list; SQL > statement:<http://192.168.1.9:8082/query.do?jsessionid=b5b3a79c0bdff34315ffa813d83b2fe4#> > > > I do see this error when using H2 and I understand that this is the normal > behavior for many databases. The question is: > > Does anyone know how I can accomplish the same result in H2? > > I tried: > > select localSymbol, localDate2 from tre_xignite a > where localDate2 in (select max(localDate2) from tre_xignite b where > a.localSymbol=b.localSymbol) > > But this doesn't seem to work.. at least not quickly. I cancelled it after > 30 seconds. I'd appreciate any help! Thanks > > Stephen > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/groups/opt_out.
