   [web] [SOLVED] Compare Columns in SQL
  Hi there,I'm having a spot of trouble with SQL in Micrososft Access, and need some advice.I have a table with a set of entries. Each entry contains two values. With these two values in each entry, I need to do two things:1. Find the average of each number across a set of entries2. Compare the two averages, and select the lower of the twoNow, I can find the two averages, no problem. However, from this query I essentially obtain a table with two columns (speaking from an Access point of view, this interpretation of the data representation may be incorrect), with one value in each column (the average for the first and second values). This is where I have a problem. How can I compare two values, which are of the same type, but exist in different columns of the same table?[Edited by - Liam M on September 7, 2007 9:36:00 PM]
  I don't think MS Access allows you to do that.It would look something like SELECT MIN(AVG(colA), AVG(colB)) FROM Table if it did.   ;  Someone told me I had to use Access Extension to do that, is that correct?   ;  Thanks for the Reply Kylotan,You put me on the right track! I managedto solve this one myself, and thought I'd share the solution for anyone who needs to know in the future.What I did was obtain th e two averages in two seperate queries, and then used UNION ALL to put these averages in the same column. If we call this Query A, all I needed to do then was go:Select MIN(ColumnName) From (A)And it all worked out! PS: JakeK isn't me, its a friend with whom I am working on this with.   