Hello,
I need someone experienced with SQL and Access to help me with a query. I currently have 5 tables: one for each of 4 different investment companies (Elliot, Eton Park, Karsch, and Greenlight), and one table called "Holdings Overlap" which gives a full list of all of these companies' current positions (stocks that they own).
What I want to do is create a query that gives me the full list of positions in the left most column, and then has four other fields (one for each company) displaying the number of times that position appears in that company's portfolio. This number could range from 0 (if they do not own the stock at all) to 3 (if they own stock and other options on the same thing). Ultimately this will help me by allowing me to see the "overlap" in holdings between these 4 companies.
Here is the SQL code I first tried to use to accomplish this, however it fails to terminate so I assume I am doing something wrong...
SELECT [Holdings Overlap].[Company Name], Count([Elliott Summary].[NAME OF ISSUER]) AS [CountOfNAME OF ISSUER], Count([Eton Park Summary].[NAME OF ISSUER]) AS [CountOfNAME OF ISSUER1], Count([Greenlight Summary].[NAME OF ISSUER]) AS [CountOfNAME OF ISSUER2], Count([Karsch Summary].[NAME OF ISSUER]) AS [CountOfNAME OF ISSUER3]
FROM [Holdings Overlap], [Elliott Summary], [Eton Park Summary], [Greenlight Summary], [Karsch Summary]
GROUP BY [Holdings Overlap].[Company Name]
HAVING (((Count([Elliott Summary].[NAME OF ISSUER]))>1) AND ((Count([Eton Park Summary].[NAME OF ISSUER]))>1) AND ((Count([Greenlight Summary].[NAME OF ISSUER]))>1) AND ((Count([Karsch Summary].[NAME OF ISSUER]))>1));
Please note that "Company Name" and "NAME IF ISSUER" both contain the list of stocks. I apologize for the confusing field names. The actual investment companies are called Eton Park, Karsch, Greenlight, and Elliott.
I feel like this should be a relatively easy query to run in Access. Could anyone please give me some advice for how to create it? Thanks!