Have bosses know what the problem is,,, an error ora00937 is not a single set of grouping function
Select
Tt. Cc,
The sum (case when tt. Name='safe' then sum (tt) userid) else 0 end)
The from
(select t. *, citigroup ame, d.n ame cc
The from t_login_answer_log t
Left the join pf_org_user u on t.u serid=u.i d
Left the join pf_org_department d on d.i d=u.d ept_id
Left the join t_login_lib lib on t.l ibid=lib. Id
Left the join t_login_category c on lib. Category=c.i d) tt
Group by tt. Cc
CodePudding user response:
Sun (tt) userid) remove the sum
CodePudding user response:
No, userid is varchar type, need a num type, demand is the need to find the number by the number of userid
CodePudding user response:
refer to the second floor of love to eat meat katz's reply: no, userid is varchar type, need a num type, the number of demand, is just a userid to check the number of Then you put the replace 1 not to go, why the userid CodePudding user response:
Select The v.c c, sum (bb) The from (select Tt. Cc, Case the when tt. Name='safe' then sum (tt) userid) else 0 end bb The from (select t. *, citigroup ame, d.n ame cc The from t_login_answer_log t Left the join pf_org_user u on t.u serid=u.i d Left the join pf_org_department d on d.i d=u.d ept_id Left the join t_login_lib lib on t.l ibid=lib. Id Left the join t_login_category c on lib. Category=c.i d) tt Group by tt. Cc ) v You have a try CodePudding user response:
the sum (case when tt. Name='safe' then sum (tt) userid) else 0 end) The sum (tt) userid), which is what to do? CodePudding user response:
reference 4 floor hrr_wait response: select The v.c c, sum (bb) The from (select Tt. Cc, Case the when tt. Name='safe' then sum (tt) userid) else 0 end bb The from (select t. *, citigroup ame, d.n ame cc The from t_login_answer_log t Left the join pf_org_user u on t.u serid=u.i d Left the join pf_org_department d on d.i d=u.d ept_id Left the join t_login_lib lib on t.l ibid=lib. Id Left the join t_login_category c on lib. Category=c.i d) tt Group by tt. Cc ) v Like you to try No, this is to not group by expression CodePudding user response:
reference yoyohey reply: 3/f Quote: refer to the second floor of love to eat meat katz's reply: no, userid is varchar type, need a num type, the number of demand, is just a userid to check the number of Then you put the replace 1 not to go, why want to use userid Because of the need to get the number of userid CodePudding user response:
reference 5 floor selling fruit net reply: the sum (case when tt. Name='safe' then sum (tt) userid) else 0 end) The sum (tt) userid), which is what to do? Get the number of userid CodePudding user response:
The sum (userid), can not get you the expected results, Table structure, test data, the expected results. PS: don't map, text content, CodePudding user response:
love to eat the meat reference 7 floor of katz's reply: Quote: refer to the third floor yoyohey response: Quote: refer to the second floor of love to eat meat katz's reply: no, userid is varchar type, need a num type, the number of demand, is just a userid to check the number of Then you put the replace 1 not to go, why want to use userid Because of the need to get the number of userid What are you here to remove the first sun to count the second, and then the else behind of 0 to null CodePudding user response:
references to the tenth floor yoyohey response: Quote: love to eat the meat reference 7 floor of katz's reply: Quote: refer to the third floor yoyohey response: Quote: refer to the second floor of love to eat meat katz's reply: no, userid is varchar type, need a num type, the number of demand, is just a userid to check the number of Then you put the replace 1 not to go, why want to use userid Because of the need to get the number of userid That you are here to remove the first sun to count the second, and then the else behind 0 to null Nb, bosses thank you very much CodePudding user response:
The location of the sum (userid) directly instead of 1 CodePudding user response:
The sum (tt) userid) to count (tt) userid), userid is not can't sum data type,