I seem to always be forgetting how to include a subquery select as part of my group by statement when I’m doing some sql that requires this.
Example of what I mean:
select tbraccd_pidm, sum(tbraccd_balance), tbraccd_term_code
where tbraccd_term_code in (‘201001’,‘200909’)
group by tbraccd_pidm, tbraccd_term_code
What I want to do is a subquery select from a phone number, like this, but don’t know how to include that in my group by clause. This would be the subquery select I’m using:
(SELECT (SPRTELE_PHONE_AREA || ‘-’ || SPRTELE_PHONE_NUMBER)
WHERE sprtele_pidm = spriden_pidm
AND SPRTELE_STATUS_IND IS NULL
Any help would be greatly appreciated.