Question: I understand it may sound confusing so let me explain what I'm trying to achieve. I have following data.

```
trxn_id      event_value
1567           4
1567           1
1567          23
2568           1
2568           4
2568           5

```

Now, I need to select all those transaction which don't have the event\_value `23`.

If I do `select trxn_id from table where event_value<>23` then apparently I'll get the trxn id since other event\_value's appear in it too.

what I did to solve this is select distinct trxn\_id and loop through them and insert only the ones which don't have event\_value 23. Like below.

```
FOR v_intrim_loop1 IN (select distinct t.trxn_id from table t)
  LOOP
    BEGIN
    if(not exists(select 1 from table where event_id=23 and trxn_id=v_intrim_loop1.trxn_id)) THEN
        insert into temp_table(trxn_id) values (v_intrim_loop1.trxn_id);
    END IF;
    END;
 END LOOP;

```

I believe there's a simple and more efficient way to do this. Please let me know how. Thanks.

Answer: 
Difference between **Grid** And **Flexbox**

---

* Flexbox best for one dimensional Layout(like Row or Column)
* CSS grid best for 2D layout (Row and Column)
* Flexbox One Dimension *ex*:[![enter image description here](https://i.stack.imgur.com/UmtLK.png)](https://i.stack.imgur.com/UmtLK.png)
* CSS Grid 2D *ex:*[![enter image description here](https://i.stack.imgur.com/6veX0.png)](https://i.stack.imgur.com/6veX0.png)
* Grid can do things Flexbox can't do, Flexbox can do things Grid can't do.
* They can work together: a grid item can be a **flexbox** container. A flex item can be a **grid** container.
* With CSS Grid we can set relationships horizontally and vertically but at the same time. **Flexbox**, on the other hand, is stuck doing either vertical or horizontal layouts.

[Further Read](https://rachelandrew.co.uk/archives/2016/03/30/should-i-use-grid-or-flexbox/)
Flexbox is 1-dimensional and enables all its direct children (‘flex items’) to sit along its main defined axis and context can potentially change if width isn’t already defined.

Whereas, CSS grids are designed to be a 2-dimensional layout system: CSS Grids can handle both columns and rows.

<https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Relationship_of_Grid_Layout>