troubleshooting Question

Top 10 & Last 5

Avatar of Kongta
KongtaFlag for Switzerland asked on
Microsoft Access
4 Comments1 Solution263 ViewsLast Modified:
I would like to show the Top10 & Last 5 of a table in one query. I tried

SELECT TOP 5 dbo_tblStatistikTmp_sb_Index.IQ, dbo_tblStatistikTmp_sb_Index.Index, dbo_tblStatistikTmp_sb_Index.Anzeige
FROM dbo_tblStatistikTmp_sb_Index
WHERE (((dbo_tblStatistikTmp_sb_Index.Technik_Anzahl)>50))
ORDER BY dbo_tblStatistikTmp_sb_Index.IQ;
 UNION
SELECT TOP 10 dbo_tblStatistikTmp_sb_Index.IQ, dbo_tblStatistikTmp_sb_Index.Index, dbo_tblStatistikTmp_sb_Index.Anzeige
FROM dbo_tblStatistikTmp_sb_Index
WHERE (((dbo_tblStatistikTmp_sb_Index.Technik_Anzahl)>50))
ORDER BY dbo_tblStatistikTmp_sb_Index.IQ DESC;

which gives me back the wrong results. Each query alone brings back the correct results, but in the UNION it doesn't work. Any idea why?
thx
Kongta
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros