Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 select max

Author  Topic 

newbie sql
Starting Member

12 Posts

Posted - 2004-09-03 : 06:20:36
I want to do something like this

select max(id) quote
where first_name = first_name and surname = 'surname'


but this returns null. The id is an identity column so is definitely not null. Can someone help me please? :)

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-09-03 : 06:24:39
How many surnames of 'surname' are in the database? Do a select with your WHERE clause first to see if any rows are returned. If not, that's why your MAX(id) is returned as NULL.


Raymond
Go to Top of Page
   

- Advertisement -