Results 1 to 3 of 3
  1. #1
    sabrina is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2010
    Posts
    2

    SQL statement


    I am trying to find a customer numbers, customer names and sales rep number for all customers that have open orders. using an alias O for the Open Orders table and C for Customers table. I need each cusotmer should appear only once. How would I write this in a SQL statement. My tables are Open Orders and Customers.

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    In your open orders table, what field(s) determines that a customer has an open order. How is it determined? How is it determined that an order is closed?

  3. #3
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    228
    Select c.customerno, c.customername, c.salesrep from customers as c
    inner join (select o.orderno, o.customerno from openorders as o where o.orderstatus = "open") as oo
    on c.customerno = oo.orderno

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

Similar Threads

  1. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  2. IIF statement
    By LilMissAttack in forum Queries
    Replies: 2
    Last Post: 08-05-2011, 08:49 AM
  3. BETWEEN in a FROM Statement
    By Cyborg in forum Queries
    Replies: 6
    Last Post: 05-12-2011, 01:54 PM
  4. Help with IF statement
    By mkallover in forum Programming
    Replies: 7
    Last Post: 01-04-2011, 04:47 PM
  5. SQL like statement?
    By Cojack in forum Queries
    Replies: 4
    Last Post: 09-21-2010, 04:45 AM

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