+ Reply to Thread
Results 1 to 2 of 2

Query - Multiple Records?

  1. #1
    Registered User
    Join Date
    05-30-2012
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    6

    Exclamation Query - Multiple Records?

    Hi so I need some help with a query.
    I have 2 tables in my database, 1 named Customers, and 2 called Orders.

    I have created a Customers Query, and what I want it to have added is a column called "VIP", which either displays "Yes" or "No".
    Like this:
    \1

    Now, I want the VIP status to be calculated.The VIP is stated as "Yes", when the "CustomerID" has appeared in the Orders Table more than 9 times (>9) OR the "CustomerID" has spent over $1200 in the "OrdersTotal" in the Orders Table. Which ever comes first. But if the "CustomerID" does not appear more than 9 times in the Orders Table, or has a sum of OrdersTotal being higher than 1200, I want this VIP value to be "No".

    Eg for example the tables:

    CUSTOMER
    CustomerID
    1
    2
    3
    4
    5

    ORDERS
    OrderID--------CustomerID------OrdersTotal
    1----------------1-------------------10
    2----------------1-------------------10
    3----------------1-------------------10
    4----------------1-------------------10
    5----------------1-------------------10
    6----------------1-------------------10
    7----------------1-------------------10
    8----------------1-------------------10
    9----------------1-------------------10
    10--------------1-------------------10
    11---------------2-------------------2000

    So the Customers Query would become:
    CUSTOMERS
    CustomerID---VIP
    1---------------YES
    2---------------YES
    3---------------NO
    4---------------NO
    5---------------NO

    CustomerID "1" would be "Yes" due to having more than 9 order (>9 orders), while CustomerID "2" would be"Yes" due to having spent more than $1200.


    Could anyone help me out here?
    I'm using MS Access 2010.
    I'd prefer if you could show me the GUI method rather than giving the SQL code. But both is still good.

    Thanks.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Query - Multiple Records?

    Cross Posted at http://forums.aspfree.com/newreply.p...ote=1&p=976329

    Please read

    http://www.excelguru.ca/content.php?184


    See my response at the cross posting
    Last edited by alansidman; 05-30-2012 at 06:58 AM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1