double prompt in union query

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
 
K

KARL DEWEY

You did not say what the prompt was. You did not give the SQL for
getCategoryQuestions.
 
A

Amy Blankenship

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]));
 
Top