View Single Post
  #1  
Old May 24th, 2004, 12:31 AM
JohnAFT
external usenet poster
 
Posts: n/a
Default Union Query Not Working Properly

I am trying to use a Union Query to pull the top 2 records for each group from
the same table. It works for the very first part (it pulls the 2 highest
numbers) but it fails in the other part of the statement...the part that fails
does give 2 records, but they are not the highest numbers.

Table name: growth
Fields: [mem]...field for name of members, (text)
[por].....field for amount (integer)
[dato]....field for date

Below if the SQL statement...why is the first part working and the other part
not?

SELECT TOP 2 growth.mem, growth.por, growth.dato
FROM growth
WHERE (((growth.por)="dw"))
ORDER BY growth.mem DESC
Union
SELECT TOP 2 growth.mem, growth.por, growth.dato
FROM growth
WHERE (((growth.por)="jj"))
ORDER BY growth.mem DESC;