oracle sql not a group by expression while counting -
this question has answer here:
- ora-00979 not group expression 7 answers
i'm trying run following query counts number of doctors patient referrals within last 6 months:
select count(local_doc.providerno) numberofreferals, local_doc.fullname fullname, local_doc.telnumber telnumber, local_doc.street street, local_doc.suburb suburb, local_doc.state state, local_doc.postcode postcode, local_doc.providerno local_doc, patient patient.providerno = local_doc.providerno , patient.referaldate <= sysdate , patient.referaldate >= add_months(sysdate, -6) group local_doc.providerno;
i keep getting
ora-00979: not group expression 00979. 00000 - "not group expression" *cause: *action: error @ line: 3 column: 5
and have no idea how around this. how so?
dear, group clause ask user specify select columns in group clause except select columns aggregated functions.
look in group clause have specify columns in select except local_doc.providerno because using aggregated function count
for better understanding please refer link
select count(local_doc.providerno) numberofreferals, local_doc.fullname fullname, local_doc.telnumber telnumber, local_doc.street street, local_doc.suburb suburb, local_doc.state state, local_doc.postcode postcode, local_doc.providerno local_doc, patient patient.providerno = local_doc.providerno , patient.referaldate <= sysdate , patient.referaldate >= add_months(sysdate, -6) group local_doc.fullname , local_doc.telnumber , local_doc.street , local_doc.suburb , local_doc.state , local_doc.postcode , local_doc.providerno
Comments
Post a Comment