By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,397 Members | 1,461 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,397 IT Pros & Developers. It's quick & easy.

Access doubt

P: 16
Hi,

I am new to access but i have some sql experience. Can you guys please help me with this:

I have two tables t1 and t2. t1 has a column c1 and t2 has c2 . c1 and c2 are almost same.I want all the records in t1 where the values c1 and c2 are equal.
i.e select * from t1 where c1=(select c2 from t2). How can i do this in access. Can you guys please guide me.
Aug 15 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 296
Hi,

I am new to access but i have some sql experience. Can you guys please help me with this:

I have two tables t1 and t2. t1 has a column c1 and t2 has c2 . c1 and c2 are almost same.I want all the records in t1 where the values c1 and c2 are equal.
i.e select * from t1 where c1=(select c2 from t2). How can i do this in access. Can you guys please guide me.
Create a new query. You can either go to design view or sql view to create the query, but since you have experience with sql, you may find it easier to use the sql view. You can try:
Expand|Select|Wrap|Line Numbers
  1. SELECT * 
  2. FROM T1 RIGHT JOIN T2 ON T1.C1 = T2.C2;
If that doesn't give the correct results try a LEFT join instead.
Aug 15 '07 #2

Rabbit
Expert Mod 10K+
P: 12,396
Actually, I think they need an INNER JOIN. I don't think they want all records from any one table, only the ones where they match up. So INNER JOIN rather than an OUTER JOIN.

And this is all SQL, Access has nothing to do with it.
Aug 15 '07 #3

Expert 100+
P: 296
Actually, I think they need an INNER JOIN. I don't think they want all records from any one table, only the ones where they match up. So INNER JOIN rather than an OUTER JOIN.

And this is all SQL, Access has nothing to do with it.
I understood it that he wanted all the records from table 1. But if he wants only the records that match up, then yes, an INNER JOIN would be correct. Thanks for adding that Rabbit.
Aug 15 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.