Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
two tables in Access. Help please.
Old 04-11-2008, 01:17 PM two tables in Access. Help please.
leadingzero's Avatar
tired of the day job

Posts: 89
Trades: 1
I am trying to run the following query where A and B are separate tables in the database:

Code:
SELECT area 
FROM A
WHERE B.area = A.area;
However, when I try to run it prompts for B.area as if it was a user submitted value. Any idea how to get this working?
leadingzero is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-11-2008, 03:22 PM Re: two tables in Access. Help please.
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
You need to include B in your from clause. Then you need to either create a join clause (FROM A JOIN B ON A.x = B.x) or put the condition in your WHERE clause that will tell the database engine how to combine the tables. Which it looks like you already have.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 04-11-2008, 05:01 PM Re: two tables in Access. Help please.
leadingzero's Avatar
tired of the day job

Posts: 89
Trades: 1
Thanks Newbie. Talkupation added.
I had to use the JOIN to get it working. I'll know next time.
leadingzero is offline
Reply With Quote
View Public Profile
 
Old 04-11-2008, 05:29 PM Re: two tables in Access. Help please.
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
I've never looked into the performance implications of each, but with a smart query optimizer I think they'd be the same. Thanks for the TP (!), and now that you've figured it out, I'll spill the answer for others. If that sounds mean, since you went and figured it out and implemented it yourself, like you said, you'll remember in future, so it's actually valuable to wait with the answer.

SELECT area
FROM A INNER JOIN B ON B.area = A.area


Or

SELECT area
FROM A, B
WHERE B.area = A.area;The second one is the old ANSI SQL way of doing it. I think most people prefer the JOIN syntax. If the query processor isn't in top shape, I think JOIN might be a little faster, but they're probably the same.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 04-16-2008, 12:26 AM Re: two tables in Access. Help please.
igniz's Avatar
Skilled Talker

Posts: 51
Name: frost
Location: philippines
Trades: 0
SELECT area
FROM A, B
WHERE B.area = A.area;

adding B with do... because B.Area only reflects A.Area. i hope it works
__________________

Please login or register to view this content. Registration is FREE
-X my site X-
igniz is offline
Reply With Quote
View Public Profile Visit igniz's homepage!
 
Reply     « Reply to two tables in Access. Help please.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16446 seconds with 12 queries