Results 1 to 7 of 7
  1. #1
    Dannat is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Jan 2012
    Posts
    18

    Complex Query.... I think?


    I have 2 tables, the first is called tblRegister and the second is tblRequest. In tblRequest I have a column named Province. In the other table I have 14 columns named after the provinces with a value of True or False within them. I need to query this table by using the tblRequest Province Column field value to retrieve that column name in the tblRegister table with a value of True that matches the tblRequest Province Column field value. How do I do this?

  2. #2
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    You should be using One Column and create a List. 14 Different Columns is not the usual way these type of things are done.

  3. #3
    Dannat is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Jan 2012
    Posts
    18
    I understand that but I am working in HR and these are imported text files of employees and there is a certain way we have to handle them. The Register table is the employee information and where they are willing to work so they may choose 1 or multiple provinces and in the text file it comes up as a true or false value depending on what they chose. the Request table are jobs that are coming up and I need to finds all employees willing to work in the province of that job.

    Its a huge headache but I have to work with what they give me.

  4. #4
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Are you saying that you have no comtrol over the design of tblRegister

  5. #5
    Dannat is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Jan 2012
    Posts
    18
    That's right. I import a text file into teh database. I have a concept of what should look like but I just don't know how to input it correctly. Here is what I have thought of but syntax is wrong:

    Select * from tblRegister
    Where tblRegister.(tblRequest.province.value)=true

    So I need the tblRequest.province.value to be inserted as the column name for the Register table. How can I get this to work?

  6. #6
    Dannat is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Jan 2012
    Posts
    18
    Does anyone know if this is possible

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    I'm with Rainlover, you need to structure the tables properly. You may import text files, but you can read that text into a meaningful structure without "concocting some strange structure".

    By putting the data into a normalized data structure, you are not changing the data values. You are optimizing the storage for processing in an RDBMS.

    I think Rainlover and I are trying to answer this part of your post
    I have a concept of what should look like but I just don't know how to input it correctly.
    You really need to understand the table structure before you start "evolving queries with no real understanding of syntax."

    For SELECT query syntax of more than one table, you will need to understand JOINs also.

    see this for a start http://www.w3schools.com/sql/sql_join_inner.asp

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

Similar Threads

  1. Query is too Complex
    By ihealy1 in forum Queries
    Replies: 2
    Last Post: 11-18-2011, 04:46 PM
  2. Complex Query
    By amotto11 in forum Queries
    Replies: 5
    Last Post: 09-02-2011, 07:43 AM
  3. Complex query to me anyway
    By AndycompanyZ in forum Queries
    Replies: 3
    Last Post: 06-28-2011, 03:08 PM
  4. Help with complex Query
    By CEV in forum Queries
    Replies: 1
    Last Post: 03-12-2011, 06:54 AM
  5. Help with complex query (for me at least)
    By GrindEspresso in forum Queries
    Replies: 5
    Last Post: 01-26-2011, 11:03 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