+ Reply to Thread
Results 1 to 6 of 6

Thread: Is Null not working! Tried Outer Join and that's not working either...

  1. #1
    Registered User
    Join Date
    06-03-2010
    Location
    Texas
    MS-Off Ver
    Excel 20
    Posts
    8

    Is Null not working! Tried Outer Join and that's not working either...

    I've got 2 tables linked on ownerID. I need ALL ownerID's to show up in my query table and if UserID in my sec user marketer table doesnt exist I still want it to show up with the ownerID and ownername from the other table with that information exists. Here's my SQL, using Access 07

    SELECT DISTINCT dbo_tbl_CO_GB_detail.OwnerID, dbo_tbl_CO_GB_detail.OwnerName, dbo_tbl_sec_user_marketer.UserID, dbo_tbl_sec_user_marketer.MarketID
    FROM dbo_tbl_sec_user_marketer RIGHT JOIN dbo_tbl_CO_GB_detail ON dbo_tbl_sec_user_marketer.OwnerID = dbo_tbl_CO_GB_detail.OwnerID
    GROUP BY dbo_tbl_CO_GB_detail.OwnerID, dbo_tbl_CO_GB_detail.OwnerName, dbo_tbl_sec_user_marketer.UserID, dbo_tbl_sec_user_marketer.MarketID
    HAVING (((dbo_tbl_CO_GB_detail.OwnerID)=2327) AND ((dbo_tbl_sec_user_marketer.MarketID)=1070));

    In the particular case above of ownerID 2327, the ownerid and ownername exists in CO GB detail but does NOT exist in sec user marketer so I'd expect to see everything populate except the UserID


    FYI - I created the query in Design view
    Last edited by TLiles; 01-05-2011 at 11:52 AM.

  2. #2
    Forum Guru ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    traded up
    MS-Off Ver
    2003 & 2010
    Posts
    1,905

    Re: Is Null not working! Tried Outer Join and that's not working either...

    You are filtering (HAVING) on either side of your join in the same query. This is likely causing the problem. Try using two queries and separate the filter. i.e. filter "marketer" in one, then join that query to the original "detail" table for the second.
    “To sin by silence when they should protest makes cowards of men.” ~ Abraham Lincoln

  3. #3
    Registered User
    Join Date
    06-03-2010
    Location
    Texas
    MS-Off Ver
    Excel 20
    Posts
    8

    Re: Is Null not working! Tried Outer Join and that's not working either...

    That worked!!!! Thanks Connie! I'm new to Access so hopefully this will become more intuitive soon!

    Is there any way to embed 1 query into another so that I dont always have to go run one and then run the other?

  4. #4
    Forum Guru ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    traded up
    MS-Off Ver
    2003 & 2010
    Posts
    1,905

    Re: Is Null not working! Tried Outer Join and that's not working either...

    If you've written the criteria into the first query (not a parameter query), you shouldn't have to open it again.
    “To sin by silence when they should protest makes cowards of men.” ~ Abraham Lincoln

  5. #5
    Registered User
    Join Date
    06-03-2010
    Location
    Texas
    MS-Off Ver
    Excel 20
    Posts
    8

    Re: Is Null not working! Tried Outer Join and that's not working either...

    oh okay, but will it refresh with the most recent data when i run query 2

  6. #6
    Forum Guru ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    traded up
    MS-Off Ver
    2003 & 2010
    Posts
    1,905

    Re: Is Null not working! Tried Outer Join and that's not working either...

    Yup.

    Cheers,
    “To sin by silence when they should protest makes cowards of men.” ~ Abraham Lincoln

+ 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