+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27

Thread: Query Join / Union

  1. #16
    Valued Forum Contributor Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds/Sheffield, England
    MS-Off Ver
    Excel 2003
    Posts
    1,030

    Re: Query Join / Union

    Any chance you could upload a sample db?
    Click the * below to say thanks

    Girls sleep with guys who use photoshop, but marry the ones who work with Excel

    Corduroy
    pillows: They're making headlines!

    Did you mean: recursion
    http://www.google.com/search?hl=en&q=recursion

  2. #17
    Registered User
    Join Date
    04-18-2011
    Location
    Bucuresti
    MS-Off Ver
    Excel 2007
    Posts
    64

    Re: Query Join / Union

    the forum doesn't allow .db uploads unfortunately, but it seems i managed to make it work using your union example. I'm not really sure why it didn't work the first time i tried it, now it works fine and with some conditional formatting when creating the report i cand get the expected result

    thanks a lot for the help

  3. #18
    Valued Forum Contributor Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds/Sheffield, England
    MS-Off Ver
    Excel 2003
    Posts
    1,030

    Re: Query Join / Union

    Glad it's working, you can zip and upload
    Click the * below to say thanks

    Girls sleep with guys who use photoshop, but marry the ones who work with Excel

    Corduroy
    pillows: They're making headlines!

    Did you mean: recursion
    http://www.google.com/search?hl=en&q=recursion

  4. #19
    Registered User
    Join Date
    04-18-2011
    Location
    Bucuresti
    MS-Off Ver
    Excel 2007
    Posts
    64

    Re: Query Join / Union

    Morning guys, although I said the issue was resolved, after some more testing I realized it's not quite there yet.

    So I made a .zip file with a test db and a .jpg showing a the result how it's now and what I need to achieve. Thanks for the help
    Attached Files Attached Files

  5. #20
    Valued Forum Contributor Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds/Sheffield, England
    MS-Off Ver
    Excel 2003
    Posts
    1,030

    Re: Query Join / Union

    Any chance you could convert this to be compatible with 2003?
    Click the * below to say thanks

    Girls sleep with guys who use photoshop, but marry the ones who work with Excel

    Corduroy
    pillows: They're making headlines!

    Did you mean: recursion
    http://www.google.com/search?hl=en&q=recursion

  6. #21
    Registered User
    Join Date
    04-18-2011
    Location
    Bucuresti
    MS-Off Ver
    Excel 2007
    Posts
    64

    Re: Query Join / Union

    here you go
    Attached Files Attached Files

  7. #22
    Valued Forum Contributor Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds/Sheffield, England
    MS-Off Ver
    Excel 2003
    Posts
    1,030

    Re: Query Join / Union

    Sorry, I can't come up with a simple way of doing this without 2 queries.

    I'm not even sure that it's possible with standard Access SQL (happy to be proved wrong however!!)

    I think you should look at 2 queries then looking at how to choose between them
    Click the * below to say thanks

    Girls sleep with guys who use photoshop, but marry the ones who work with Excel

    Corduroy
    pillows: They're making headlines!

    Did you mean: recursion
    http://www.google.com/search?hl=en&q=recursion

  8. #23
    Registered User
    Join Date
    04-18-2011
    Location
    Bucuresti
    MS-Off Ver
    Excel 2007
    Posts
    64

    Re: Query Join / Union

    Thanks for trying, i wasn't looking for a specific way to resolve the issue. If it takes 3 queries to do it, it's fine with me

  9. #24
    Forum Guru davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2007
    Posts
    1,879

    Re: Query Join / Union

    How's this:

    SELECT Table1.ContractID, Table1.Beneficiar, Table1.ValueContract, Table1.FinishDate, Table2.AditionalID, Table2.FazeNumber, Table2.ValueAditional, Table2.FinishDate
    FROM Table1 INNER JOIN Table2 ON Table1.ContractID = Table2.ContractID 
    WHERE (((Table2.FinishDate) Between Now() And Now()-5))  AND EXISTS (SELECT  FinishDate FROM Table2 WHERE Table2.FinishDate Between Now() And Now()-5);
    It seemed to work on your sample database.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  10. #25
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,265

    Re: Query Join / Union

    I thought you just have to uncheck the "SHOW" boxes for all of table 1 and this would solve your problem?

    Also in your Between( ) - I thought the smaller number needed to come first but what do I know?
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  11. #26
    Valued Forum Contributor Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds/Sheffield, England
    MS-Off Ver
    Excel 2003
    Posts
    1,030

    Re: Query Join / Union

    Thanks dave, came so close to that it's untrue lol, couldnt quite grt my head round it!
    Click the * below to say thanks

    Girls sleep with guys who use photoshop, but marry the ones who work with Excel

    Corduroy
    pillows: They're making headlines!

    Did you mean: recursion
    http://www.google.com/search?hl=en&q=recursion

  12. #27
    Forum Guru davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2007
    Posts
    1,879

    Re: Query Join / Union

    Marvin: All the documentation I can find agrees that the first 'argument' in the between predicate must be greater than the last. Not sure why it works in the example database the opposite way, but it does.

    As far as showing the results from Table 1, the original post wanted most fields from both tables; I don't see how unchecking those would give the requested results.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

+ 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.2.0