sql - Having trouble with Distinct(Coloumn_name) -
i'm having problems getting correct data tables. i've got table information on customers sending letters.
my table have following coloumbs( name, postalcode, country, phone_number, letters(the number of letters))
i want numbers of letters send every customer, depending on postal_code.
select distinct(postal_code), count(*) table_name group postal_code, letters
the result of this, not wanted, because duplicates of postalcode, , numbers of letters wrong. i'm pretty new stuff, hope can me.
edit:
at moment, i'm trying date on record, , code slike now.
select postal_code, sum(letters), to_char(trunc(start_time),'dd-mm-yyyy') starttime table_name group postal_code
but error when running it. error says: ora-00937: not single-group group function. have googlet problem, , tried start_time in group by, gives me wrong result.
if use group don't need distinct. since letters number need sum() them. total letters each postal code along lines of:
select postal_code, sum(letters) table_name group postal_code
Comments
Post a Comment