Re: [SQL] group by complications

2006-02-16 Thread Markus Schaber
Hi, Mark, Mark Fenbers schrieb: > Wow! I didn't know you could have a (select ...) as a replacement for a > 'from' table/query. Your SQL worked as-is, except I had to add a 'limit > 1' to the first subquery. > > Thanks! I would have never figured that out on my own! SQL has more power than mo

Re: [SQL] group by complications

2006-02-16 Thread Mark Fenbers
Wow!  I didn't know you could have a (select ...) as a replacement for a 'from' table/query.  Your SQL worked as-is, except I had to add a 'limit 1' to the first subquery. Thanks!  I would have never figured that out on my own! Mark chester c young wrote: --- Mark Fenbers <[EMAIL PROTECTE

Re: [SQL] group by complications

2006-02-13 Thread chester c young
--- Mark Fenbers <[EMAIL PROTECTED]> wrote: > select l.lid,l.fs,max(h.obstime) from location as l > inner join height as h on h.lid = l.lid > where l.fs > 0.0 > group by l.lid,l.fs; > > The above query works as expected in that is fetches the lid, fs and > time of the latest observation in the h

[SQL] group by complications

2006-02-13 Thread Mark Fenbers
select l.lid,l.fs,max(h.obstime) from location as l inner join height as h on h.lid = l.lid where l.fs > 0.0 group by l.lid,l.fs; The above query works as expected in that is fetches the lid, fs and time of the latest observation in the height table (for the corresponding lid), but I also want