[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] How to take sum of varchar column ?
From:       Marcin Mionskowski <mionskowskimarcin () gmail ! com>
Date:       2019-05-17 3:46:46
Message-ID: 8bf6cb6baff6c6e98a034f70cedb3ab631d33b41.camel () gmail ! com
[Download RAW message or body]

How do you want to sum your VARCHAR column? What kind of values are
stored in that column?
And how is your question in the topic related to the content of your
email?
And what do you mean by "but not with where command"?

If you want just this one code (EGLL), than you can do (with WHERE):
SELECT count(distinct airport_id) 
FROM example_table 
WHERE upper(icao_cd)='EGLL';
-- count distinct if you have non-unique airport_id's

If you want all of the codes, do (without WHERE:):
SELECT upper(icao_cd), count(distinct airport_id) 
FROM example_table 
GROUP BY upper(icao_cd);

Marcin

W dniu czw, 16.05.2019 o godzinie 21∶11 +0100, użytkownik Taylan
Karakurt napisał:
> Hello everyone,
> 
> I have an example job from my client and figuring out it with
> postgresql. I imported the csv data which is approx. 3 million rows.
> I'm trying to get for example how many airport id has EGLL code but
> not with where command. Tried to sum but didnt work. We were doing
> same thing before at my previous job. Every help appreciated. 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic