[ic] is there a way to pull out a max value in a database

Thanh Luong interchange-users@icdevgroup.org
Thu Nov 21 11:14:36 2002


--- Stefan Hornburg <racke@linuxia.de> wrote:

> > > >
> > > > If you are using a mysql database, I believe
> mysql has some function
> > > > built in for this.
> > >
> > > I suppose that [query sql="select code from
> my_database order
> > > by code desc limit 1"]
> > > will work on any database in IC.
> > >
> > > Bye
> > >         Racke
> > 
> > 
> > OH ok, yes IC, this works great Racke. Tom, I have
> tested this here:
> > 
> > http://demo.icdevgroup.org/i/demo1/test
> > 
> > using:
> > 
> > [query type=list sql="select sku from products
> order by sku desc limit
> > 1"]
> > [list]
> > [sql-code]<br>
> > [/list]
> > [/query]
> > 
> > This is interesting. Thanks Racke!
> 
> It works due to the fact that IC passes the query to
> the SQL::Statement module
> if the database isn't a SQL one. 
> 
> select sku from products order by sku desc limit 1 
> 
> is equivalent to
> 
> select max(sku) from products
> 
> Bye
>         Racke

Thanks everyone!! This works Great,
Exactly what I was looking for,
Thank,
Tom

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com