while i am executing this piece of code i am able to generate the correct result:

select parent.MEMBER_ID, count(child.MOVIE_ID) from parent left join child parent.MEMBER_ID = child.MEMBER_ID group by parent.MEMBER_ID;

but when i am adding another field from parent field, i am getting an group by expression error:

select parent.MEMBER_ID, parent.lname, count(child.MOVIE_ID) from parent left join child parent.MEMBER_ID = child.MEMBER_ID group by parent.MEMBER_ID;

try this

SELECT parent.MEMBER_ID, parent.lname, COUNT(child.MOVIE_ID) FROM parent left join child parent.MEMBER_ID = child.MEMBER_ID GROUP BY parent.MEMBER_ID,parent.lname;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.