How can I collect 4 quieries in one query?

  • Thread starter Mohamed Helmy Mostafa
  • Start date
M

Mohamed Helmy Mostafa

SELECT CountJudge.Year, CountJudge.Quarter, CountJudge.ID, CountJudge.Name,
CountJudge.[Task#], CountJudge.StartDate, CountJudge.EndDate,
CountJudge.Duration, CountJudge.Judge, CountNotJudge.NotJudge,
CountMale.Male, CountFemale.Female,
Count_All_Participants.All_Participants_Day
FROM ((CountMale RIGHT JOIN CountFemale ON CountMale.ID=CountFemale.ID)
RIGHT JOIN (CountNotJudge RIGHT JOIN CountJudge ON
CountNotJudge.ID=CountJudge.ID) ON CountFemale.ID=CountNotJudge.ID) RIGHT
JOIN Count_All_Participants ON CountJudge.ID=Count_All_Participants.ID;
 
J

Jeff Boyce

Insufficient data ...

I'm not clear on what you are asking for, nor what you have now...
 
T

Todd Shillam

Provided you have the same number of fields in each query, for example four
queries of the same table just with different parameters. You can use the
UNION operator to join your queries and return a single result set--you
cannot use the UNION operator in Microsoft's Query Design view, only the SQL
view. To make it simple, just create two queries using the design view. Open
the second query in SQL view and copy the code. Then open the first query in
SQL view. At the end of the code (on a new line) type 'UNION' and press the
{Enter} key for a new line--then paste your SQL code from the second query.
Finally, save and close. Lastly, open your query and you should see the
combined results returned in a single query.

SELECT...
FROM...
WHERE...;
UNION
SELECT...
FROM...
WHERE...;

Best regards,

Todd

SELECT CountJudge.Year, CountJudge.Quarter, CountJudge.ID,
CountJudge.Name, CountJudge.[Task#], CountJudge.StartDate,
CountJudge.EndDate, CountJudge.Duration, CountJudge.Judge,
CountNotJudge.NotJudge, CountMale.Male, CountFemale.Female,
Count_All_Participants.All_Participants_Day
FROM ((CountMale RIGHT JOIN CountFemale ON
CountMale.ID=CountFemale.ID) RIGHT JOIN (CountNotJudge RIGHT JOIN
CountJudge ON CountNotJudge.ID=CountJudge.ID) ON
CountFemale.ID=CountNotJudge.ID) RIGHT JOIN Count_All_Participants ON
CountJudge.ID=Count_All_Participants.ID;
 
Top