Solved

Select statement not working when MAX function is used.

Posted on 2013-11-22
1
329 Views
Last Modified: 2013-11-22
I get the following error when I execute the SELECT statement seen below...

You tried to execute a query that does not inclue the specified expression 'questioncode' as part of an aggregate function.

SELECT questioncode, MAX(regulatoryanswer), inpracticeresponse from vmasterdata where questioncode = 'GQ-005' and regulatoryanswer like "*Day*" or regulatoryanswer like "*Month*"

I am trying to get the largest value in the regulatory column.

This statement works fine without the MAX.

Could somebody help with this and tell me what I am doing wrong?

Thanks.
0
Comment
Question by:tesla764
1 Comment
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39669635
try this


SELECT questioncode, MAX(regulatoryanswer), inpracticeresponse from vmasterdata where questioncode = 'GQ-005' and regulatoryanswer like "*Day*" or regulatoryanswer like "*Month*"
group by questioncode, inpracticeresponse
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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