Results 1 to 11 of 11
  1. #1
    bubbly_74 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7

    Access 2010 chapter 7 labe1 question 6. I need help

    find the customer numbers, customer names, and sales rep numbers for all customers that have open orders. Use the alias O for the Open Orders table and C for the Customer table. Each customer should appear only once.

    This is what I have tried but doesn't work. I am lost!

    SELECT O.[Customer Number], O.[Customer Name, O.[sales rep number, C.[Customer Number], C.[Customer Name], C.[sales rep number]
    FROM [Open Orders] O, [Customer] C
    WHERE O.[Customer Number] = C.[Customer Number]


    AND O.[Customer Name]= C.[Customer Name]
    AND O.[sales rep number]=C.[sales rep number]
    ;

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps you can use AS to define the text that will be your Alias' name. Try creating an Alias field using the query builder for additional hints.

  3. #3
    bubbly_74 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    I have changed my SQL to:

    SELECT DISTINCT O.[Customer Number], O.[Customer Name], O.[sales rep number], C.[Customer Number], C.[Customer Name], C.[sales rep number]
    FROM [Open Orders] AS O, Customer AS C;

    It pulls up the data needed except the customers are pulling up more than once. How can I fix this.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps you can add additional WHERE criteria to better conform your SQL statement to the Business Rules. I think I see some Business Rules in question #6 that are not defined in your WHERE clause.

  5. #5
    bubbly_74 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    I changed it to

    SELECT DISTINCT O.[Customer Number], O.[Customer Name], O.[sales rep number], C.[Customer Number], C.[Customer Name], C.[sales rep number]
    FROM [Open Orders] AS O, Customer AS C
    WHERE O.[Customer Number] = C.[Customer Number]
    ;

    I get an enter parameter box O. Customer and I get an enter parameter box O. Sales number and the following result. How do I fix it so the result shows the first column as custnum, 2nd column cust name, 3rd sales rep#?
    O.Customer Number Customer Name sales rep number Cust # C.Customer Name SR #
    AM23

    AM23 Amy's Store 44
    CM09

    CM09 Casual by Marie 51
    CY12

    CY12 Curlin Yoga Studio 49
    FN19

    FN19 Fitness Counts 51
    JN34

    JN34 Just Natural 49
    LB20

    LB20 Le Beauty Salon & Spa 49
    RD03

    RD03 Rose's Day Spa 51
    TT21

    TT21 Tan and Tone 44

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Are you using the Query Builder or just trying to type the SQL? You are missing a JOIN. So either Post#3 does not include all of the syntax or you never had a functioning query.

    I suggest you create a basic SELECT query and worry about the WHERE clause last.

  7. #7
    bubbly_74 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    Just trying to use the SQL.

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Define your JOIN. Define what field(s) to join on. Define the JOIN type, ie RIGHT, INNER, etc.
    http://www.w3schools.com/sql/sql_join_inner.asp

  9. #9
    bubbly_74 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    Thank you so much for your help and patients.

  10. #10
    bubbly_74 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    Know I just have to figure out how to get the customer name to show up only once



    Cust # Customer Name SR #
    AM23 Amy's Store 44
    AM23 Amy's Store 44
    CM09 Casual by Marie 51
    CY12 Curlin Yoga Studio 49
    FN19 Fitness Counts 51
    JN34 Just Natural 49
    JN34 Just Natural 49
    LB20 Le Beauty Salon & Spa 49
    RD03 Rose's Day Spa 51
    RD03 Rose's Day Spa 51
    TT21 Tan and Tone 44

  11. #11
    bubbly_74 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    I finally got it!!!!!!!!!!!!!!!!!!!

    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. access 2010 question
    By earl in forum Access
    Replies: 3
    Last Post: 02-20-2013, 05:01 PM
  2. access 2010 question
    By earl in forum Access
    Replies: 1
    Last Post: 02-18-2013, 10:41 PM
  3. Replies: 1
    Last Post: 11-21-2011, 08:39 PM
  4. access 2010 vba question
    By jscriptor09 in forum Access
    Replies: 1
    Last Post: 08-26-2011, 06:57 AM
  5. ACCESS 2010 vba question
    By jscriptor09 in forum Access
    Replies: 1
    Last Post: 07-26-2011, 03:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums