This will return max()+1 other wise 1 if no records is there.
select
case
when count(*) > 0
then
max(eno)+1
else
1
end as max
from
emp
select
case
when count(*) > 0
then
max(eno)+1
else
1
end as max
from
emp
________________________________________________________________________________________
No comments:
Post a Comment