If you're on Oracle, you can do:
SELECT nvl(max(some_item),0)
FROM db
WHERE item = 'something'
That will give you 0 if there are no "something" and will give you the
value.
Paul Rensel wrote:
>Hi there,
>
>I want to use a "select max(some_item) from db where item = 'something"
>query.
>
>How c
you could count the number of records in your table first.
Then if count is greater than 0 you can do your max selection. I assume you are
trying to find the max value stored in a field. Such as, the largest row_id.
Paul Rensel wrote:
>
> Hi there,
>
> I want to use a "select max(some_item)
Hi there,
I want to use a "select max(some_item) from db where item = 'something"
query.
How can i check or test if there is indeed a max(some_item) for a given
'something' selection given and when there's not an max(some_item) ??
I've tried everything like $sth->rows and such but it seems that