Tough multi-table JOIN query

  • Hello,

    I'm having trouble with a multi-table JOIN statement with more than one JOIN statement.

    For each order, I need to return the following: CarsID, CarModelName, MakeID, OrderDate, ProductName, Total ordered the Car Category.

    The carid (primary key) and carmodelname belong to the Cars table.

    The makeid and orderdate belong to the OrderDetails table.

    The productname and carcategory belong to the Product table.

    The number of rows returned should be the same as the number of rows in OrderDetails.

    Thanks in advance!

    RM

  • This looks like homework.

    You should read the link in my signature line to lean what to post and include what you have done so far.

    Mapping what you did provide, you have a CarID, a MakeID and a CarCategory. Nothing in this suggest any kind of relationship between the tables.

    __________________________________________________________________________________________________________
    How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Show what you've done so far. The T-SQL syntax you're looking for is JOIN.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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