1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

SQL 2008 help

Discussion in 'General Software' started by BarbaricSoul, Aug 11, 2013.

  1. BarbaricSoul

    BarbaricSoul

    Joined:
    Feb 21, 2008
    Messages:
    5,096 (2.15/day)
    Thanks Received:
    1,996
    I'm having a problem and I hope someone can offer some help. Let me start by saying I'm not looking for someone to do my work for me. I'm looking for someone to help me understand what I'm doing and how to do it.

    Ok, what I'm trying to do is retrieve data from two tables in one query. I'm on step 1 in the assignment details on the left side of the picture. I have the code to pull the info, but I can't figure out how to join the results into on table. When I type in the JOIN command, it's always dark gray, unlike the SELECT, and ORDER BY, which are blue. Is this a problem? Also, even though I have the primary key in my customer table and foreign key in my Orders table set to CustomerID, and they are associated with eachother, I keep getting the error in the picture. Can someone please help me with what I'm doing wrong here? I don't want you to do it for me, just explain what I'm doing wrong.

    [​IMG]
    Crunching for Team TPU
  2. BarbaricSoul

    BarbaricSoul

    Joined:
    Feb 21, 2008
    Messages:
    5,096 (2.15/day)
    Thanks Received:
    1,996
    ok, I figured out why I was getting that error, but the results are still coming up as two separate tables as seen here-
    [​IMG]

    Please, someone explain to me what I'm doing wrong with my JOIN statement
    Crunching for Team TPU
  3. BarbaricSoul

    BarbaricSoul

    Joined:
    Feb 21, 2008
    Messages:
    5,096 (2.15/day)
    Thanks Received:
    1,996
    Well I figured it out. Seems I was going about it wrong, this is the proper code with the right results-

    [​IMG]
    Crunching for Team TPU

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page