sql - Error in using subquery in access join query

I need to use the result of a query as a lookup field for another query. What I tried was using a sub query aliased as something, but finally I got some error saying "enter parameter value" for variz.variz and Y.varizname.

I've searched in forums, but I can't find any similar problem.

SELECT sahmeharkas.attrib, 
    [sahmeharkas]![expenseper] AS Expense,
FROM sahmeharkas
(SELECT variz.varizname FROM variz GROUP BY variz.varizname) as Y
ON sahmeharkas.attrib =  Y.variz.varizname

1 Answer

  1. David- Reply


    The table variz does not exist outside of the subquery; you should instead use the subquery alias as the table qualifier, e.g.:

    select s.attrib, s.expenseper as expense, y.variz
        sahmeharkas s left join 
        (select v.variz, v.varizname from variz v group by v.variz, v.varizname) y on
        s.attrib = y.varizname

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>