SQL Query question for school project

  • Hi,

    I hope this is the right spot to write this. I don't understand any of this stuff but i needed help with writing some sql for a project for school.

    I have two tables of stock information. On one I have the company name's and the other provides me with dates and closing prices on the stocks within the last year (but no company names). Some of the company's don't have dates because they went public less than a year ago.

    I want to run a query that will use both tables to show me all the company name's that do not have a matching date.

    Here is the SQL for a query of just the two parts of the information:

    SELECT Company.[Company Name], DailyStockPrice.Date

    FROM Company INNER JOIN DailyStockPrice ON Company.[Ticker] = DailyStockPrice.[Ticker]

    GROUP BY Company.[Company Name], DailyStockPrice.Date;

    Thank you for your help in advance, and if this is in the wrong place, please direct me accordingly.

  • try,

    SELECT Company.[Company Name], DailyStockPrice.Date

    FROM Company LEFT OUTER JOIN DailyStockPrice ON Company.[Ticker] = DailyStockPrice.[Ticker]

    WHERE DailyStockPrice.Date IS NULL

    GROUP BY Company.[Company Name], DailyStockPrice.Date;

  • Access will create this kind of query for you - create a new query and choose the "Find unmatched query wizard" from the menu, then follow the prompts

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply