I have the following table

```
GroupID Sequence    Name
1             10        Mary
1             25        Jack
1             17        Jill
2              3        Peter
2             42        Henry
2             50        Paul

```

The following query returns a row with the next lowest sequence (10) for a given group (1) and a given sequence of 17

```
SELECT TOP 1 *
FROM   dbo.customerassignmentgroup
WHERE  groupid = 1
       AND SEQUENCE < (SELECT MAX(SEQUENCE)
                       FROM   dbo.customerassignmentgroup i
                       WHERE  i.groupid = customerassignmentgroup .groupid)
       AND manualsequence < 17
ORDER  BY SEQUENCE DESC

```

Is there another way of doing this? I am trying to avoid 

> 
> WHERE i.groupid =
>  customerassignmentgroup .groupid
> 
> 
> 

in the inner query because I need to convert this to a query in SubSonic

Note: My database is SQL Server 2000