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.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | silviadanaStarting Member
 
 
                                        2 Posts | 
                                            
                                            |  Posted - 2010-03-09 : 15:50:37 
 |  
                                            | HelloI need help with two problems in Access. I believe that they are similar but I don't know how it worksI problem: I have a table TELEPHONE(telephone_number) where telephone number is the only field. I have to find the first number that is missingFor example: suppose that I have the entries 125789The result for the sql that I need would be 3. I believe that i need to do the difference between two consecutive rows and to find the first row where this difference is greater than 1The second problem is similar I think: A table Temperatures(day, temperature) and I need to find the bigest difference between two consecutive datesday     temp1.01      52.01      43.01      94.01      5and the result would be 5 |  |  
                                    | silviadanaStarting Member
 
 
                                    2 Posts | 
                                        
                                          |  Posted - 2010-03-09 : 20:14:53 
 |  
                                          | I would give myself an answer. If you know another methods please post themFor the first problem Select top 1 s.[telephone_number] + 1 from telephone as s where not exists (Select 1 from telephone as s2 where s2.[telephone_number]= s.[telephone_number]+ 1)For the second one SELECT max(abs(x1.temperature-x2.temperature)) AS difFROM temperatures AS x1 LEFT JOIN temperatures AS x2 ON x1.day=x2.day+1; |  
                                          |  |  |  
                                |  |  |  |