Re: [SQL] Need to return one field for multiple Rows

2011-07-21 Thread Ozer, Pam
Never Mind Ifigured it out. I just need to use agg_array From: Ozer, Pam Sent: Thursday, July 21, 2011 4:09 PM To: pgsql-sql@postgresql.org Subject: Need to return one field for multiple Rows I have the following query Select PubArticleId, PubArticlePageXML from PubarticlePageXml x

[SQL] Need to return one field for multiple Rows

2011-07-21 Thread Ozer, Pam
I have the following query Select PubArticleId, PubArticlePageXML from PubarticlePageXml x Inner Join Pubarticlepage p on x.pubarticlepageid=p.pubarticlepageid where pubarticleid=188321 Which Returns PubArticleId(Integer)PubArticlePageXML(Text) 188321 fdfaldkjf 1

Re: [SQL] Sorting Issue

2011-05-25 Thread Ozer, Pam
Of Ozer, Pam Sent: Wednesday, May 18, 2011 3:22 PM To: Tom Lane Cc: Samuel Gendler; em...@encs.concordia.ca; pgsql-sql@postgresql.org Subject: Re: [SQL] Sorting Issue Is there anywhere that gives you all the available collations and their definitions? I found with the C collation it now sorts the

Re: [SQL] Sorting Issue

2011-05-18 Thread Ozer, Pam
: Tuesday, May 10, 2011 9:47 AM To: Ozer, Pam Cc: Samuel Gendler; em...@encs.concordia.ca; pgsql-sql@postgresql.org Subject: Re: [SQL] Sorting Issue "Ozer, Pam" writes: > Isn't this the English standard for collation? Or is this a non-c > locale as mentioned below? Is the

Re: [SQL] Sorting Issue

2011-05-10 Thread Ozer, Pam
Isn't this the English standard for collation? Or is this a non-c locale as mentioned below? Is there anyway around this? LC_COLLATE = 'en_US.utf8' Thanks Pam -Original Message----- From: Ozer, Pam Sent: Monday, May 09, 2011 3:13 PM To: 'Tom Lane

Re: [SQL] Sorting Issue

2011-05-10 Thread Ozer, Pam
I was wrong it is LC_COLLATE = 'en_US.utf8' -Original Message----- From: Ozer, Pam Sent: Monday, May 09, 2011 3:13 PM To: 'Tom Lane'; Samuel Gendler Cc: em...@encs.concordia.ca; pgsql-sql@postgresql.org Subject: RE: [SQL] Sorting Issue Th

Re: [SQL] Sorting Issue

2011-05-09 Thread Ozer, Pam
The collate setting is LC_COLLATE = 'English_United States.1252' -Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Monday, May 09, 2011 2:29 PM To: Samuel Gendler Cc: em...@encs.concordia.ca; Ozer, Pam; pgsql-sql@postgresql.org Subject: Re: [SQL] Sor

Re: [SQL] Sorting Issue

2011-05-09 Thread Ozer, Pam
Ok but why doesn't the other way work? I can't use the function in my query. It is dynamically created. -Original Message- From: Emi Lu [mailto:em...@encs.concordia.ca] Sent: Monday, May 09, 2011 12:52 PM To: Ozer, Pam Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Sor

Re: [SQL] Sorting Issue

2011-05-09 Thread Ozer, Pam
That works. Why? -Original Message- From: Emi Lu [mailto:em...@encs.concordia.ca] Sent: Monday, May 09, 2011 12:38 PM To: Ozer, Pam Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Sorting Issue > I have the following query > > Select VehicleTrimAbbreviated, VehicleTrimAbbr

[SQL] Sorting Issue

2011-05-09 Thread Ozer, Pam
I have the following query Select VehicleTrimAbbreviated, VehicleTrimAbbreviatedId from VehicleTrimAbbreviated Where vehicleTrimAbbreviated like 'CX%' order by VehicleTrimAbbreviated asc Results: 532;"CX Hatchback" 536;"CXL Minivan" 3255;"CXL Premium Sedan" 537;"CXL Sedan" 538;"CXL

Re: [SQL] Aggregates puzzle

2011-03-31 Thread Ozer, Pam
Try this. Once you know the value you want you have to join back to find the time of that value. Select f.Lid, F.Value,F.event_id, f.obstime From ( SELECT lid, MAX(value) As Value, event_id FROM flood_ts GROUP BY lid, event_id )sub Join flood f On sub.Value=f.value and f.lid=sub.lid and sub.event

Re: [SQL] Function To Strip HTML

2011-02-23 Thread Ozer, Pam
27;\3'), E'(?x)(< [^>]*? >)', '', 'g') 3$$ LANGUAGE SQL; From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Ozer, Pam Sent: Wednesday, February 23, 2011 3:41 PM To: pgsql-sql@postgresql.org Subject: [SQL] Fun

[SQL] Function To Strip HTML

2011-02-23 Thread Ozer, Pam
I have the following function that I used in MSSQL. I would like to create the same function in PostgreSql. I think I am a bit confused on how to create and set variables in PostgreSql. Can someone give me a place to start to create something like this? Thanks Pam SET ANSI_NULL

Re: [SQL] Getting top 2 by Category

2011-01-11 Thread Ozer, Pam
Perfect. Thank You. I knew there had to be something simple. From: Peter Steinheuser [mailto:psteinheu...@myyearbook.com] Sent: Tuesday, January 11, 2011 11:52 AM To: Ozer, Pam Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Getting top 2 by Category Well, if yoi have PG 8.4 and above

[SQL] Getting top 2 by Category

2011-01-11 Thread Ozer, Pam
This is probably very simple but I am drawing a blank. Do I need to create a cursor to iterate through a table to grab the top 2 magazines per category? Here is my table and some data . The results I need are at the bottom. Any help would be greatly appreciated: CREATE TABLE magazinecatego

Re: [SQL] Overlapping Ranges- Query Alternative

2010-11-12 Thread Ozer, Pam
Thank you all for your suggestions. I will try each of these and see which one fits my situation best. From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Andreas Gaab Sent: Friday, November 12, 2010 12:23 AM To: Ozer, Pam; pgsql-sql@postgresql.org Subject

[SQL] Overlapping Ranges- Query Alternative

2010-11-11 Thread Ozer, Pam
I have the following problem: Create temp table ranges (Groups int, ColumnA int); Insert into ranges Values(2,45); Select Groups, Case when ColumnA between 0 and 19 then 0 when ColumnA >=20 then 20 when ColumnA >=30 then 30 when ColumnA>=40 then 40 when ColumnA>=

Re: [SQL] Random sort with distinct

2010-10-04 Thread Ozer, Pam
What about dynamic queries? From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Dmitriy Igrishin Sent: Saturday, October 02, 2010 6:40 AM To: Ozer, Pam Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Random sort with distinct Hey Ozer, How about

[SQL] Random sort with distinct

2010-10-02 Thread Ozer, Pam
I have the following query Select Distinct VehicleMake, VehicleModel >From VehicleYearMakeModelTrim Order by random() Limit 10; I don't want to bring back the random number I just want the sort order to be random. How can I sort randomly? This query breaks because random() is not in the

[SQL] Question Regarding Unique Index on Table

2010-09-23 Thread Ozer, Pam
Is it possible to disable a unique index? I have a process that's running that inserts duplicate records into a table and then does a cleanup afterwards. I know that I can drop the index and rebuild. I just didn't know if there was disable the uniqueness temporarily. thanks Pam Ozer Dat