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.
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
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?
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
oh okay, but will it refresh with the most recent data when i run query 2
Yup.
Cheers,
“To sin by silence when they should protest makes cowards of men.” ~ Abraham Lincoln
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks