Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HI everyone, hope you are well. I need the help in about SQL Query I have this query but I am getting an error, does

HI everyone,

hope you are well.

I need the help in about SQL Query

I have this query but I am getting an error, does anyone can help me with this issue, please?

best regard.

the SQL Query is:

SELECT

r.[DebtorNumber] AS 'Patient Id No.' ,

MAX(CONVERT(VARCHAR(10), CAST(aus.AuditDateTime as date),101)) AS 'Last Worked'

FROM

AgentRangeList a

LEFT JOIN RPT_Calculated r on r.DebtorNumber = a.DebtorNumber and a.ClientCode = r.ClientCode

JOIN AuditDetails aus on r.DebtorNumber = aus.DebtorNumber and r.ClientCode = aus.ClientCode

group by aus.AuditDateTime

and this is the error I am getting

Msg 8120, Level 16, State 1, Line 2 Column 'RPT_Calculated.DebtorNumber' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions