Dynamic parameter in SQL subquery

D

Dave

I have a report form that I gather report parameters and
then dynamically create the strWhereCategory string which
I use in the DoCmd.OpenReport command.

The problem is that I need to have two date parameters
from the form that I need applied to the subquery (see sql
below). I need the two date parameters added in the in
clause with the "analysis_track_flag = -1" subquery
clause. If I just add them to the strWhereCategory string
and then execute the report, it just prompts for the
login_date parameters since there is no login_date field
in the table of the outer query. Is there any way that I
can dynamically change the inner query that is going
against the SG_QUERY_TERMS_V table?

Thanks,

ave

SELECT DOM.DOMAIN, DOM.IP_ADDRESS, DOM.WHOIS_INFO
FROM sg_domains AS DOM INNER JOIN sg_sessions AS SES ON
(DOM.IP_ADDRESS=SES.IP_ADDRESS) AND (DOM.DOMAIN=SES.DOMAIN)
WHERE ((SES.SESSION_SEQ)
In (select SESSION_SEQ from SG_QUERY_TERMS_V AS TERMS_V
where analysis_track_flag = -1))
GROUP BY DOM.DOMAIN, DOM.IP_ADDRESS, DOM.WHOIS_INFO
ORDER BY DOM.DOMAIN;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top