Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2003
    Posts
    6

    Post Unanswered: Uniting Tbles and Queries

    Hello what I need is to unite 2 tables and one SQL query
    together and then base a form on that one query.

    I have an SQL query which has a UNION ALL statement in it
    and I need to add to a new query this one query and the
    other two tables and only show the records that they hold.

    Is there a way to do this?

    Many Thanks

    James

  2. #2
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    Yeah do this

    Select * from Table1 union Select * from Table2 Union Select * from Query1

  3. #3
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91
    Hi !

    As I´m not an expert in SQL, when I need to "write" a complicate statement, I do as follow:

    I Open the Query Assistent. Built my Query, then choose the show/SQL Mode option in the menu.

    Crtl-C Ctrl-V

    Obs.: Sorry if the option´s name aren´t correct. My access is in portuguese.

    Bye

  4. #4
    Join Date
    Oct 2003
    Posts
    6

    Post Uniting Tables and Queries

    Ok then I would try this but would it work even if I had diffrent amounts of fields in each table/query or would that not matter?

    Many Thanks

    James

  5. #5
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91

    Re: Uniting Tables and Queries

    James:

    There is no problem!

  6. #6
    Join Date
    Oct 2003
    Posts
    6

    Post Uniting tables and queries

    If I put all teh fields in the new query from my existing two tables and my query it seems to keep duplicating the data???

  7. #7
    Join Date
    Oct 2003
    Posts
    6

    Post Uniting Tables and Queries

    If I put all the fields in the new query from my existing two tables and my query it seems to keep duplicating the data???

    Is there a way of stopping it from doing this?

    Many Thanks

    James

  8. #8
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91

    Re: Uniting Tables and Queries

    No !

    A querie is a dinamic set of data. So you don´t duplicate it.

    Of course, if you put fields that you won´t use, you´ll spend more memory (RAM).

  9. #9
    Join Date
    Oct 2003
    Posts
    6

    Post Uniting tables and queries

    But this is waht the query does on its own is there no command I can put in to just ask it simply to just display the data that is there rather than it being confused and giving me daft amounts of data which is just being duplicated over and over.

    Could I do it in a UNION ALL query if so how would I do this with more than two sets of data?

    Many Thanks

    James

  10. #10
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91

    Re: Uniting tables and queries

    Originally posted by Morpheus83uk
    But this is waht the query does on its own is there no command I can put in to just ask it simply to just display the data that is there rather than it being confused and giving me daft amounts of data which is just being duplicated over and over.

    Could I do it in a UNION ALL query if so how would I do this with more than two sets of data?

    Many Thanks

    James
    Would you like to send me your tables and queries ? (please, not more than 300 kbytes)

  11. #11
    Join Date
    Oct 2003
    Posts
    6

    Uniting Tables and Queries

    Hello thats no problem I will need an E-Mail address for me to send the database to and then I will let you know what you will need to work with...

    Many Thanks

    James

Posting Permissions

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