# Joining two SQL cells (or csvs)

**URL:** <https://talk.observablehq.com/t/joining-two-sql-cells-or-csvs/10153>\
**Category:** Help\
**Created:** [January 7, 2025, 4:54pm UTC](https://talk.observablehq.com/t/joining-two-sql-cells-or-csvs/10153 "2025-01-07T16:54:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a-lexwein](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/a-lexwein/32/9419_2.png) [@a-lexwein](https://talk.observablehq.com/u/a-lexwein)\
**Post date:** [January 7, 2025, 4:54pm UTC](https://talk.observablehq.com/t/joining-two-sql-cells-or-csvs/10153/1 "2025-01-07T16:54:12Z")

</div>

I really like the SQL cells in notebooks and much prefer to wrangle data in SQL over JS.

- I have a CSV of opportunities and another CSV of accounts. Is there a way to join them together in a SQL?
- If instead, I want to transform `opportunities` into `opportunities_clean` in a cell and then join it to a transformed `accounts_clean` in a new cell, how would I do that?

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [January 7, 2025, 8:10pm UTC](https://talk.observablehq.com/t/joining-two-sql-cells-or-csvs/10153/2 "2025-01-07T20:10:21Z")

</div>

You can create an in-memory DuckDB database with multiple tables: [Database clients | Observable documentation](https://observablehq.com/documentation/data/databases/database-clients#duckdb)

The cell then becomes available as data source for SQL and Data Table cells.

---

<div class="post-metadata">

**Author:** ![a-lexwein](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/a-lexwein/32/9419_2.png) [@a-lexwein](https://talk.observablehq.com/u/a-lexwein)\
**Post date:** [January 7, 2025, 8:33pm UTC](https://talk.observablehq.com/t/joining-two-sql-cells-or-csvs/10153/3 "2025-01-07T20:33:58Z")

</div>

Yes that did the trick. Thanks so much.
