Question: I'm new to AngularJS; can someone help me why the below code is not validating the form?

```
<form name="reviewForm" ng-controller="ReviewController as reviewCtrl" ng-submit="reviewCtrl.addReview(product);" novalidate>
    <select ng-model="reviewCtrl.review.stars" required>
        <option value="">Rate the Product</option>
        <option value="1">1 Star</option>
        <option value="2">2 Star</option>
    </select>
    <textarea ng-model="reviewCtrl.review.body"></textarea>
    <input type="email" ng-model="reviewCtrl.review.author" required/>
    <div>ReviewForm is: {{reviewForm.$valid}}</div>
    <input type="submit" value="Submit" />
</form>

```

Answer: 
In sql server 2012 and above you can use the [`Lead`](https://msdn.microsoft.com/en-us/library/hh213125(v=sql.110).aspx) window function to get the value of the next row. Assuming you have some way to sort the data (like an identity column), you can use this to your advantage:

```
SELECT Name, 
       Surname, 
       Salary, 
       CASE WHEN TaxPercentage = LEAD(TaxPercentage) OVER (ORDER BY Id) THEN 
         NULL 
       ELSE 
          TaxPercentage 
       END As TaxPercentage 
FROM Employees
ORDER BY Id

```

See [fiddle](http://sqlfiddle.com/#!6/fa954/1) (thanks to [Lasse V. Karlsen](https://stackoverflow.com/users/267/lasse-v-karlsen))
If for some reason you can't use `LEAD()` then this should work:

```
with T as (
    SELECT
        Name, Surname, Salary, TaxPercentage,
        row_number() over (order by TaxPercentage /* ??? */) as rn
    FROM Employees
)
select
    Name, Surname, Salary,
    nullif(
        TaxPercentage,
        (select t2.rn from T as t2 where t2.rn = t.rn + 1)
    ) as TaxPercentage
from T as t

```