Results 1 to 5 of 5
  1. #1
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568

    What instead where clause? Interview question

    Hi,

    I had yesterday "simple" interview question.

    I have 2 columns table with 1 000 000 records for example.

    Attachment 31212
    Click image for larger version. 

Name:	Przechwytywanie.JPG 
Views:	15 
Size:	28.5 KB 
ID:	31213

    and in column T-shirt will be 1000 different colors, but i want to get only 50 of them.

    I can do it using where clause and OR statement but i have to wright it 50 times.

    I did not know how to do in different way and recruiter sad that i can do it using inner join within the query.


    So divide within query second table with choosen colors from T-shirt and use inner join to show only matching names.

    I do not have idea how to do it using only one table.
    Can you please help me?

    Best wishes,
    Jacek Antek

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    jacek,
    Here's an example from one of my tables

    Code:
    SELECT TOP 50 
    tbl_Spl_LCL_Std_EstDetail.Est_Name
    , tbl_Spl_LCL_Std_EstDetail.EMAIL_ADR
    , tbl_Spl_LCL_Std_EstDetail.URL
    , tbl_Spl_LCL_Std_EstDetail.ESTBLMT_EMP_CNT
    FROM tbl_Spl_LCL_Std_EstDetail 
    where email_adr is not null;

    This selects TOP 50 of ESTDetail records where the company has an email address.

    You could sort on a different field(s) and get a different 50, or any other number of records.

    Here is an older link with more info.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    And I don't understand the recruiter's suggested query structure unless it involved 2 tables.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    June,
    I agree -often readers are still having to guess at the requirement/issue to be resolved and parameters.

  5. #5
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Thank you Guys,

    yes it is very strange question and issue/requirement i had to guess.
    I am trying to reach recruteir in order to find out what he meant.

    Jacek

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

Similar Threads

  1. Question on an If clause
    By Ayiramala in forum Access
    Replies: 8
    Last Post: 11-27-2015, 06:30 PM
  2. Need help with a WHERE clause
    By DB88 in forum Access
    Replies: 10
    Last Post: 06-11-2014, 01:40 PM
  3. Max within a where clause
    By kdayboll in forum Queries
    Replies: 2
    Last Post: 09-14-2013, 12:13 PM
  4. Where clause
    By Amerigo in forum Queries
    Replies: 2
    Last Post: 03-30-2011, 07:34 AM
  5. IIF clause
    By Peljo in forum Queries
    Replies: 2
    Last Post: 02-05-2008, 11:22 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