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

Sub-Query chaos!

P: n/a
Can anyone help me. I'm an absolute Access newbie and this query is
stumping me.

I have a linked Access to MySQL table structure on which the following
Access QUERY works GREAT.

SELECT opinions.opinion_title,
Mid$(opinionvotes!vote_demographics,13,1) AS politic_need,
Sum(opinionvotes.vote_want_yes) AS SumOfvote_want_yes,
Sum(opinionvotes.vote_want_no) AS SumOfvote_want_no,
Sum(opinionvotes.vote_agree_yes) AS SumOfvote_agree_yes,
Sum(opinionvotes.vote_agree_no) AS SumOfvote_agree_no
FROM (opinionvotes INNER JOIN opinions ON opinionvotes.opinion_id =
opinions.opinion_id) INNER JOIN users ON opinionvotes.userID =
WHERE (((opinions.opinion_group)="us2004election"))
GROUP BY opinions.opinion_title,
Mid$(opinionvotes!vote_demographics,13,1), opinions.userID,
ORDER BY opinions.userID DESC;

BUT .. I need to finish the query by having the politic_need (which is
the Mid$(opinionvotes!vote_demographics,13,1) query field) be replaced
by a friend label in another table.

such as this: [select politics_label from politics where politics_code
= politic_need]

So, to confirm, I need my large query above to SHOW the looked up
subquery label and not the politic_need 1 character code.

Any ideas!?

richard @
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Can anyone help me with a problem.

Using the DESIGN QUERY screen in Access ... I defined this field from
an existing table .. opinion votes.

politic_need: Mid$([opinionvotes].[vote_demographics],13,1)

It returns a one-character value - from 'A' through 'G'
I'd like to create a new expression (a sub-query!?) in my query that
looks up a friendly LABEL for this field .. based on the contents of
another table..

something like SELECT politics_label FROM politics WHERE politics_code
= politic_need

BUT I keep getting errors when I try to create it!. Any ideas!?

for SCREENSHOT! [tough to describe otherwise! :-) ]
Thanks for any help! This is driving me nuts!
Richard @

This is for my site ... ... to create
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.