Gossamer Forum
Home : General : Databases and SQL :

Re: [gskahlon79] "not a GROUP BY expression"

Quote Reply
Re: [gskahlon79] "not a GROUP BY expression" In reply to
This Problem can be solved by following

SELECT project_consultant.p_id, SUM(total_hours) Total, project_name, client_name, c_last, c_first, total_hours
FROM consultant, client, project, project_consultant
WHERE consultant.c_id = project.mgr_id
AND client.client_id = project.client_id
AND project.p_id = project.p_id
AND project.p_id = project_consultant.p_id
AND consultant.c_id = project_consultant.c_id
GROUP BY project_consultant.p_id, project_name, client_name, c_last, c_first, total_hours

I Think This Will execute ur querry but the purpose wont be solved if u really need totalling in your reports then use sqlplus commands like compute and break feature

Pl note that when u r using group by with select statements then u should group by all the columns in the select statement on which no function is executed.

:)
Subject Author Views Date
Thread "not a GROUP BY expression" gskahlon79 21608 Jan 22, 2003, 6:01 PM
Post Re: [gskahlon79] "not a GROUP BY expression"
Alex 21011 Jan 23, 2003, 12:33 AM
Post Re: [gskahlon79] "not a GROUP BY expression"
Stealth 21001 Jan 23, 2003, 12:37 PM
Post Re: [gskahlon79] "not a GROUP BY expression"
anup123 20446 Mar 23, 2003, 1:10 PM