double prompt in union query

  • Thread starter Thread starter Amy Blankenship
  • Start date Start date
A

Amy Blankenship

I have a union query that takes data out of two columns in a parameter query
and puts it into one column. I had a version of the query that only got
prompted once for the parameter:

SELECT getCategoryQuestions.SubCatMajor,
Count(getCategoryQuestions.SubCatMajor) AS CatCount, 2 AS Weight
FROM getCategoryQuestions
GROUP BY getCategoryQuestions.SubCatMajor

UNION SELECT getCategoryQuestions.subcatminor,
Count(getCategoryQuestions.subcatminor) AS CatCount, 1 AS Weight
FROM getCategoryQuestions
GROUP BY getCategoryQuestions.subcatminor
ORDER BY Weight DESC;


However, that doesn't quite do what I want, so I changed it to

SELECT getCategoryQuestions.SubCatMajor,
Count(getCategoryQuestions.SubCatMajor) AS CatCount, 2 *
Count(getCategoryQuestions.SubCatMajor) AS NumPoints
FROM getCategoryQuestions
GROUP BY getCategoryQuestions.SubCatMajor

UNION SELECT getCategoryQuestions.SubCatMinor,
Count(getCategoryQuestions.SubCatMinor) AS CatCount, 1 *
Count(getCategoryQuestions.SubCatMinor) AS NumPoints
FROM getCategoryQuestions
GROUP BY getCategoryQuestions.SubCatMinor;

However, this gets prompted twice for the same parameter. Any thoughts as
to what the difference might be?

Thanks;

Amy
 
It's a pretty ordinary parameter query.

SELECT Question.QuestionID, Question.SubCatMajor, Question.SubCatMinor
FROM Question INNER JOIN ((Category INNER JOIN Topic ON Category.CategoryID
= Topic.CategoryID) INNER JOIN Page ON Topic.TopicID = Page.ParentID) ON
Question.QuestionID = Page.QuestionID
WHERE (((Question.SubCatMajor)>0) AND ((Question.SubCatMinor)>0) AND
((Category.CategoryID)=[Enter CatID]));
 

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

Back
Top