Query problem

  • Im using ms sql 2008,

    I have two tables, table 1 has two values out of 5 I want to return, one of the columns contains values that appear in table two, not all of the values appear in table two, I only want to return the values for the two columns in table one that correspond with the value not appearing in table two, and also return a sum value.

    The tables are as follows,

    table 1 is console games, columns are, GameNumber(PK), GameDetails, RetailPrice, ConsoleFormat, GamesStock,

    table two is,

    InvoiceNumber(PK), GameNumber(FK-from table1), GameQTYOrdered, TransactionCompleted,

    I need to return the following from the query,

    ConsoleFormat, GameNumber and total cash value of games not appearing in table 2, so that would be games never processed in an order.

  • I think you are looking form something like this.

    SELECT ConsoleFormat, GameNumber, RetailPrice

    FROM [Table1]

    WHERE GameNumber NOT IN (SELECT GameNumber FROM [Table2])

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

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