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))
You should have some way to order the data in order. In my example, I am using simple `IDENTITY` column, in your it could be primary key or date:

```
DECLARE @DataSource  TABLE
(
     [Name] VARCHAR(12)
    ,[Surname] VARCHAR(12)
    ,[Salary] VARCHAR(12)
    ,[TaxPercentage] DECIMAL(9,1)
    --
    ,[RowID] TINYINT IDENTITY(1,1)
);

INSERT INTO @DataSource ([Name], [Surname], [Salary], [TaxPercentage])
VALUES ('Moosa', 'Jacobs', '$14000', '13.5')
      ,('Temba', 'Martins', '$15000', '13.5')
      ,('Jack', ' Hendricks', '$14000', '13.5')
      ,('Temba', 'Martins', '$15000', '1.5')
      ,('Jack', ' Hendricks', '$14000', '1.5')
      ,('Temba', 'Martins', '$15000', '23')
      ,('Jack', ' Hendricks', '$14000', '7')
      ,('Temba', 'Martins', '$15000', '7')
      ,('Jack', ' Hendricks', '$14000', '7')

SELECT [Name]
      ,[Surname]
      ,[Salary]
      ,[TaxPercentage]
      ,NULLIF([TaxPercentage], LEAD([TaxPercentage], 1, NULL) OVER (ORDER BY [RowID])) AS [NewTaxPercentage]
FROM @DataSource;

```