I want to create a view by doing some select on two huge tables I have (one with over 10 million lines)

the first one has the following columns, we'll call it WRSD : 

> 
> ID\_Deal,Year, GVKEY\_ACQ, TARGET\_GVKEY
> 
> 
> 

in this table we have some transaction with an ID for the acquiror and another one for the target (hence de GVKEY)

The second one is called mytable :

> 
> ID\_firm, year, subcat, totalpat, numpat
> 
> 
> 

`WRSD.GVKEY_acq` and `WRSD.TARGET_GVKEY` reference `mytable.ID_firm`

And I want to select a table that will show :

> 
> ID\_DEAL, GVKEY\_acq, year, subcat, totalpat, numpat, TARGET\_GVKEY,
>  totalpat, numpat
> 
> 
> 

So that I can compare the data between the two firms for every subcategory.

I tried a lot of queries but none of them worked, does someone have any clue about how to solve this problem ?

Thanks a lot.