Solved

Select statement not working when MAX function is used.

Posted on 2013-11-22
1
325 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 119

Accepted Solution

by:
Rey Obrero 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This collection of functions covers all the normal rounding methods of just about any numeric value.
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now