-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

On Fri, 26 Nov 2004 09:24 pm, David Heinemeier Hansson wrote:
> On Fri, 26 Nov 2004 07:22 pm, Raif S. Naffah wrote:
> > at = Attack.find_by_sql(\
> >   "SELECT MIN(occured_on) " +\
> >   "FROM attacks " +\
> >   "WHERE occured_on BETWEEN '#{start_date_str}' AND
> > '#{end_date_str}'")[0].min
>
> ...I would have
> thought you needed to do "MIN(occured_on) as min" to get the effect
> you're looking for.

aliasing the aggregate function works with both PostgreSQL and MySQL.

 
cheers;
rsn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Que du magnifique

iD8DBQFBrCxM+e1AKnsTRiERA16TAJ92aHqiuXMqJoD6zjszSHw3/WrevACfViOy
aANLW5IuVhM+zNd6fRga3n4=
=nBin
-----END PGP SIGNATURE-----