Aug 7 2006, 07:06 PM
Hello to all,
Just started using access, I am looking for a place for newbies in the access world. But anyway need a little help on a problem. I have a table with the name of some books and their prices. I want to query for the highest and least expensive. Can not figure out the parameter to do so. From My research I think I have to do do two seperate queries and combine them to display as one. I have the two queries but can not figure out how to combine. Any help will be greatly appreciated. Thanks.
Aug 7 2006, 07:34 PM
Welcome to UtterAccess,
You should be able to do a query, and group it and use Min and Max.
Add the table to the query, select the price field twice, and then at the top, you will seea button like a M on its side, tooltip will say Totals. Choose this, and on one of the fields, change Group by to Min, and change the otehr to Max.
Hope this helps,
Aug 7 2006, 07:36 PM
One way to combine them is with a UNION query.
Open one of the queries in Design View. Click View--->SQL View.
Copy the SQL statement you find there.
Close the query.
Open a brand new query in Design View. Click Close on the Add Tables box. Then click SQL at the left end of the toolbar. Paste in the SQL statement that you copied earlier. Get rid of the ; at the end of the statement, press the Enter key, and type UNION. Minimize this query.
Open the other query of interest in Design View. Click View--->SQL View. Copy its SQL statement. Close this query.
Maximize the minimized query. Click to the right of the UNION and press Enter.
Then paste in the SQL statement that you copied earlier.
This will not work unless you have the same number of fields in both queries. I believe the types of the fields have to be the same in corresponding positions too.