SQL novice hoping to get some help with a select statement
I can run this successfully:
select distinct t.QUALIFIEDORGUNITCODE as DEALERNUMBER,
count(distinct(t.TRANSACTIONID)) as TRANSACTION_VOLUME
from adtdealers.transaction t
where t.DATECREATED between '01-oct-17' and '01-nov-17'
group by t.QUALIFIEDORGUNITCODE;
but if I attempt to add another field to the select I receive the following error:
ORA-00936: missing expression 00936. 00000 - "missing expression" *Cause: *Action: Error at Line: 17 Column: 105
select to_char(t.DATECREATED, 'MON-DD') as DAY,
count(distinct(t.TRANSACTIONID)) as TRANSACTION_VOLUME,
distinct t.QUALIFIEDORGUNITCODE as DEALERNUMBER
from adtdealers.transaction t
where t.DATECREATED between '01-oct-17' and '01-nov-17'
group by to_char(t.DATECREATED, 'MON-DD'), t.QUALIFIEDORGUNITCODE;
I can also run this succesfully:
select distinct t.QUALIFIEDORGUNITCODE as DEALERNUMBER,
to_char(t.DATECREATED, 'MON-DD') as DAY
from adtdealers.transaction t
where t.DATECREATED between '01-oct-17' and '01-nov-17'
group by t.QUALIFIEDORGUNITCODE, t.DATECREATED;