Question: I am trying to iterate over an object that's in an array of an array, however, I'm not able to display the data in the front-end.

I tried this method:

```
<div *ngFor="let item of events of event | keyvalue">
    {{item.key}}:{{item.value}}
</div>

```

and this one:

```
<div *ngFor="let item of events of event | json">
   Test: {{item}}
</div>

```

The structure of the JSON data is given in this format.

```
[
    [
        {
            "age": "age3",
            "gender": "gender3"
        },
        {
            "age": "age3",
            "gender": "gender3"
        }
    ]
]

```

Answer: 
with ROWCOUNT this command tells you the number of rows that read in the database from the last query that execute. You can first execute the query (SELECT DISTINCT ID FROM import) to know, how many rows will be affected and validate if is correct

Set @@ROWCOUNT the number of rows affected or read.

here is an example.

```
USE AdventureWorks2012;  
GO  
UPDATE HumanResources.Employee   
SET JobTitle = N'Executive'  
WHERE NationalIDNumber = 123456789  
IF @@ROWCOUNT = 0  
PRINT 'Warning: No rows were updated';  
GO  

```

[here](https://learn.microsoft.com/en-us/sql/t-sql/functions/rowcount-transact-sql?view=sql-server-ver15) is more information about it.
You can use `COUNT(*)` to count all the rows returned by the query or `COUNT(DISTINCT ID)` to get the count of all the different IDs in your query. I guess this could help you: [https://www.javatpoint.com/mysql-count#:~:text=MySQL%20count()%20function%20is,not%20find%20any%20matching%20rows](https://www.javatpoint.com/mysql-count#:%7E:text=MySQL%20count()%20function%20is,not%20find%20any%20matching%20rows).

Anyway this would be the implementation:

```
CREATE PROCEDURE `UpdateUsers`()
BEGIN

DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
    SHOW ERRORS;
      ROLLBACK;
END;

START TRANSACTION;
UPDATE users SET status='A'
WHERE id IN (SELECT DISTINCT ID FROM import);
COMMIT;
SELECT COUNT(DISTINCT ID) FROM import;
END

```

Or in the case you want this value to be in a variable it would be like this:

```
DECLARE COUNT_DISTINCT INT;
SET COUNT_DISTINCT =(SELECT COUNT(DISTINCT ID) FROM import);

```