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
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.