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 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 the max()
>functions ALWAYS returns a record, even when there's no max(some_item)
>
>Thanks,
>
>Paul
>
>
>
>


Reply via email to