Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MS ACCESS and SQL

Posted on 2015-02-12
3
129 Views
Last Modified: 2015-03-14
I am trying to get the min and max values for an attribute and display the id associated with each value and write SQL for this. Specifically I need to Identify the highest and lowest performers for each of 33 quality measures from the Medicare shared savings program 2013 Quality results. The table for the 2013 Quality results has the first column as the ACO name, then values in 33 columns to the right with that ACOs numeric grade for ACO-1 to ACO-33 (as the metrics of quality).  There are 221 ACO names or records each with 33 grades.

Here is the SQL I used but the results show the first row as the lowest performing ACO and the second Column is the highest performer for that ACO.  How can I alter the query to answer the question and pull the highest ACo and Lowest ACO for each of the 33 ACO quality metrics into a single result set?

SELECT ACO_Name, Max(Aco_1) AS Max_ACO_1,  Min(Aco_1) AS MIN_ACO_1
FROM MEd_shared_savings
WHERE ACO_1 = (Select Max(Aco_1) From MEd_shared_savings) or
   ACO_1 = (Select Min(Aco_1) From MEd_shared_savings)
GROUP BY Aco_name;

This is the result set that shows the correct data but it is supposed to be in 1 row.  Please advise as to what to do in SQL and MS Access.


ACO_Name      Max_ACO_1      MIN_ACO_1
Essential Care Partners II, LLC.      66.89      66.89
Genesis Accountable Care Organization, LLC      89.71      89.71
ACO-QualityMetrics-Performance.accdb
0
Comment
Question by:chonabraham
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 40607439
This will return one row:

SELECT
    Max(Aco_1) AS Max_ACO_1,  
    Min(Aco_1) AS MIN_ACO_1
FROM
    MEd_shared_savings

But your table looks like a spreadsheet and something that should be solved with Excel.

What is your expected output?

/gustav
0
 

Author Comment

by:chonabraham
ID: 40607958
Yes, this was an excel spreadsheet but I needed to convert it to a DB for an example. I need the name of the ACO to Display for every Min or Max value of the each measures (ACO_1 through ACO-33).
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 40608245
OK, but then do this in the Excel sheet before moving the data to Access.
It is a snap in Excel but will require a stupid and lengthy code in Access to achieve.

/gustav
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cannot conntect to Windows Live Mail automatically (Am always asked to Sign In) 5 24
Insert Into syntax error 10 29
Record with #Error 8 33
default combobox value 12 18
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question