Re: [SQL] how to do a find and replace

2005-11-17 Thread A. Kretschmer
am 17.11.2005, um 14:51:05 -0800 mailte Dawn Buie folgendes: > Hello- > > I have a column of data with the wrong prefix for many items. If you have 8.1? If yes: > > The wrong entries are entered ' /0/v.myimage.jpg' > While the correct ones are ' /0/myimage.jpg' > > > I need to remove all the

Re: [SQL] how to do a find and replace

2005-11-17 Thread Hélder M . Vieira
update media_instance set location=replace(location,'v.','') where location like '%/0/v.%' For more complex search/replace operations, 8.1 provides an interesting function, named 'regexp_replace'. It probably goes unnoticed because although there is a small reference in the manual in section

Re: [SQL] how to do a find and replace

2005-11-17 Thread Bricklen Anderson
Dawn Buie wrote: > I used: > > update media_instance set location=replace(location,'v.','') > where location like '%/0/v.%' > > and that did work- > > thank you very much. > > it seems to me that the replace function is the same as translate()- no? > Right, I forgot your WHERE clause. Some mo

Re: [SQL] how to do a find and replace

2005-11-17 Thread Dawn Buie
I used: update media_instance set location=replace(location,'v.','') where location like '%/0/v.%' and that did work- thank you very much. it seems to me that the replace function is the same as translate()- no? On 17-Nov-05, at 3:55 PM, Bricklen Anderson wrote: Dawn Buie wrote: Hello- I'm

Re: [SQL] how to do a find and replace

2005-11-17 Thread Bricklen Anderson
Dawn Buie wrote: > Hello- > I'm using postgres 7.4 > > I have a column of data with the wrong prefix for many items. > > The wrong entries are entered ' /0/v.myimage.jpg' > While the correct ones are ' /0/myimage.jpg' > > > I need to remove all the 'v.' characters from this column. > > > I'm

[SQL] how to do a find and replace

2005-11-17 Thread Dawn Buie
Hello- I have a column of data with the wrong prefix for many items. The wrong entries are entered ' /0/v.myimage.jpg' While the correct ones are ' /0/myimage.jpg' I need to remove all the 'v.' characters from this column. I'm able to do a SELECT * FROM myTable WHERE location = '%/0/v.%'

[SQL] how to do a find and replace

2005-11-17 Thread Dawn Buie
Hello- I'm using postgres 7.4 I have a column of data with the wrong prefix for many items. The wrong entries are entered ' /0/v.myimage.jpg' While the correct ones are ' /0/myimage.jpg' I need to remove all the 'v.' characters from this column. I'm able to do a SELECT * FROM myTable WHERE

[SQL]

2005-11-17 Thread Brian Doyle
---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] timestamp SQL question

2005-11-17 Thread codeWarrior
WHERE event_type < NOW() - interval '30 days'; "Brian Doyle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have a table like: > > events > visitor_uid varchar(32) > event_type varchar(32) > event_type timestamp > > I would like to select events from the table that are olde

[SQL] timestamp SQL question

2005-11-17 Thread Brian Doyle
I have a table like: events visitor_uid varchar(32) event_type varchar(32) event_type timestamp I would like to select events from the table that are older than 30 days from right now. How would I do that in one query? Thanks. ---(end of broadcast)---

Re: [SQL] Geographic Distance Calc website

2005-11-17 Thread Michael Fuhr
On Thu, Nov 17, 2005 at 01:31:17PM -0800, PaulD wrote: > I found the original website: > > http://www.sanisoft.com/ziploc/ If you're doing this sort of thing in PostgreSQL then have a look at contrib/earthdistance, or for more elaborate GIS needs, PostGIS. http://postgis.refractions.net/ -- Mi

[SQL] Geographic Distance Calc website

2005-11-17 Thread PaulD
I found the original website: http://www.sanisoft.com/ziploc/

[SQL] Geographic DB

2005-11-17 Thread PaulD
Having been asked, I posted a mySQL dump of latitude, longitude and zip codes for the US.  I've also included a PHP zipcode computational piece of code, a DB manager, and the page itself all in GZIP format.  Instructions are on the page. P.S.  I can't possibly help you if you're having problems

[SQL] Geographic DB

2005-11-17 Thread PaulD
Hi,I actually implemented something in PHP/mySQL that is a DB of latitudes& longitudes and zipcodes. The formula computes distance 'as the crowflies' using the radius of the Earth between 2 zipcodes, etc. It's here:http://www.deschuteshay.com/distance/ziptest1.phpI wish I could remember where I g

Re: [SQL] idea for a geographically distributed database: how best

2005-11-17 Thread Andy Ballingall
>Andy, i agree with what codeWarrior says. But if you are interested in replication, dbmirror is very elegant (altho not as trendy) simple, and highly customizable replication solution. I have heavily modified dbmirror to even support Asynchronous Conditional row grained Foreign key dependency

Re: [SQL] idea for a geographically distributed database: how best to implement?

2005-11-17 Thread Andy Ballingall
Hi again, I don't think I've explained my idea well enough: >You might want to consider using latitude and longitude or zip codes or taking more of a traditional "GIS" approach rather than duplicating data across redundant databases. I do use coordinates to position data. The databases aren't

Re: [SQL] idea for a geographically distributed database: how best

2005-11-17 Thread Achilleus Mantzios
O codeWarrior έγραψε στις Nov 17, 2005 : > Sounds like a mis-guided approach to me... > > You might want to consider using latitude and longitude or zip codes or > taking more of a traditional "GIS" approach rather than duplicating data > across redundant databases. > > Another issue is that y

Re: [SQL] idea for a geographically distributed database: how best to implement?

2005-11-17 Thread codeWarrior
Sounds like a mis-guided approach to me... You might want to consider using latitude and longitude or zip codes or taking more of a traditional "GIS" approach rather than duplicating data across redundant databases. Another issue is that you end up having to query every database to find proxim

Re: [SQL] Arrya variable as argument to IN expression

2005-11-17 Thread Tom Lane
Emil Kaffeshop <[EMAIL PROTECTED]> writes: > SELECT b IN (a) INTO flag; !!! does not work > Is it legal to expect the array to be interpret as > list of integers which IN expression takes ? No. But try "b = any (a)". regards, tom lane ---(end of

[SQL] idea for a geographically distributed database: how best to implement?

2005-11-17 Thread Andy Ballingall
Hello, I've got a database for a website which is a variant of the 'show stuff near to me' sort of thing. Rather than host this database on a single server, I have a scheme in mind to break the database up geographically so that each one can run comfortably on a small server, but I'm not sure abo

Re: [SQL] Arrya variable as argument to IN expression

2005-11-17 Thread A. Kretschmer
am 17.11.2005, um 0:28:51 -0800 mailte Emil Kaffeshop folgendes: > Hello I am trying the following: > a INTEGER[] := ''{10,15,20}''; > b INTEGER := 15; > flag BOOLEAN := FALSE; > > SELECT b IN (a) INTO flag; !!! does not work Sorry, i can't understand your query. Perhaps you are searchfing for

Re: [SQL] Arrya variable as argument to IN expression

2005-11-17 Thread Achilleus Mantzios
O Emil Kaffeshop έγραψε στις Nov 17, 2005 : > Hello I am trying the following: > a INTEGER[] := ''{10,15,20}''; > b INTEGER := 15; > flag BOOLEAN := FALSE; > > SELECT b IN (a) INTO flag; !!! does not work contrib/intarray and SELECT intset(b) ~ a::int[] INTO flag; are your friends. > > Is it l

[SQL] Arrya variable as argument to IN expression

2005-11-17 Thread Emil Kaffeshop
Hello I am trying the following: a INTEGER[] := ''{10,15,20}''; b INTEGER := 15; flag BOOLEAN := FALSE; SELECT b IN (a) INTO flag; !!! does not work Is it legal to expect the array to be interpret as list of integers which IN expression takes ? Best Regards Emil kafegiiski __