group by clause

Ken Lord kenlord at GMAIL.COM
Mon Aug 15 23:44:06 EDT 2005


Hi Jason, 
 You could try a DATA string something like this ... 
 DATA "the_geom FROM (SELECT * FROM sounding.sdgonly_20050722point WHERE 
elevation > 0 AND mod(gid, 300) = 1 GROUP BY the_geom HAVING max(dispx) > 
86738) AS foo USING UNIQUE gid USING SRID=26910"
 .... I've capitalized the SQL keywords just to make them more readable. The 
DATA string should all be on one line (not sure how this will post to the 
list).
.... Use the appropriate SRID number in place of 26910, representing the 
projection of your data. 
 Cheers,
Ken Lord
Vancouver BC


On 8/15/05, Jason FU <tsfu at hkucs.org> wrote: 
> 
> What do I do for the sql statement as follows:
> 
> select the_geom from sounding.sdgonly_20050722point
> where elevation > 0 and mod(gid, 300) = 1
> group by the_geom
> having max(dispx) > 86738
> 
> ?
> 
> ================================================================
> 
> CREATE TABLE sounding.sdgonly_20050722point
> (
> gid serial NOT NULL,
> recno int8,
> elevation float8,
> dataflags int8,
> dispx float8,
> dispy float8,
> size float8,
> angle float8,
> scale int8,
> keyword varchar,
> usernum int8,
> fcode varchar,
> datatype int4,
> descflags int8,
> themenum int8,
> indexkey varchar,
> superflags int8,
> sourceid varchar,
> the_geom geometry,
> CONSTRAINT sdgonly_20050722point_pkey PRIMARY KEY (gid),
> CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
> CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
> 'POINT'::text OR the_geom IS NULL),
> CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = -1)
> )
> WITH OIDS;
> ================================================================
> I tried this one in MapServer but it doesn't work at all.
> 
> DATA "the_geom from sounding.sdgonly_20050722point"
> FILTER " (elevation > 0 and mod(gid, 300) = 1) # group by the_geom "
> 
> Please advise.
> 
> Thanks.
> 
> Jason
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050815/18ff40fc/attachment.html


More information about the mapserver-users mailing list