Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started