is this a subquery problem?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rich buchanan

    #1

    is this a subquery problem?

    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_demographi cs],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!?

    see http://www.rcbuchanan.com/subquery.jpg
    for SCREENSHOT! [tough to describe otherwise! :-) ]


    Thanks for any help! This is driving me nuts!
    Richard
  • Allen Browne

    #2
    Re: is this a subquery problem?

    Your query has a GROUP BY clause.

    Try:
    MyResult: ( SELECT politics_label FROM politics
    WHERE politics_code = Mid([opinionvotes].[vote_demographi cs],13,1)


    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html

    "rich buchanan" <richard@rcbuch anan.com> wrote in message
    news:74ec62bf.0 309281853.1aca9 4ab@posting.goo gle.com...[color=blue]
    > 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_demographi cs],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!?
    >
    > see http://www.rcbuchanan.com/subquery.jpg
    > for SCREENSHOT! [tough to describe otherwise! :-) ]
    >
    >
    > Thanks for any help! This is driving me nuts!
    > Richard[/color]


    Comment

    Working...