[GENERAL] selecting all columns but one

2009-07-28 Thread blackwater dev
I have a table with a lot of columns. One of the columns I want to alias so have a query of: select *, column as newname from mytable. The problem is I now have column and newname in the results. I don't want to select column by column. How can I do a select * but omit one? Thanks!

[GENERAL] getting column value length

2009-02-03 Thread blackwater dev
I need to return all rows in a table where one of the columns 'name' is 37+ characters. In postgres, is there a function to get the length of the columns contents? Thanks!

[GENERAL] open transaction?

2008-12-29 Thread blackwater dev
I just logged into postgres from the command line and did: begin: select blah; select blah; \q Without thinking I closed by connection before committing or rolling back my transaction. Did postgres handle this for me? How do I see if the transaction is still open? Thanks!

[GENERAL] date stamp on update?

2008-11-22 Thread blackwater dev
Is there a datatype in postgres that will automatically update the date when the row is updated? I know I can do a timestamp and set the default to now() but once the row is inserted, and then edited, I want the column updated without editing my application code or adding a trigger. Is this possi

[GENERAL] grabbing date of last Sunday?

2008-10-10 Thread blackwater dev
How can I grab the date from the last Sunday based on when I run the query? For example I run it today, and I need to date of 10-5-08, if I ran it next week, I would want 10-12-08, etc. Thanks!

Re: [GENERAL] finding firstname + lastname groups

2008-06-19 Thread blackwater dev
Great, thanks! On Thu, Jun 19, 2008 at 5:14 PM, Sam Mason <[EMAIL PROTECTED]> wrote: > On Thu, Jun 19, 2008 at 03:38:28PM -0400, blackwater dev wrote: > > The problem is name is not one column but made up of firstname, > > lastname...how do I do this? > > I&#

[GENERAL] finding firstname + lastname groups

2008-06-19 Thread blackwater dev
I have to find the same firstname+ lastname combo in my db and see which name appears the most so I basically need to do the following: select name, count(name) from people group by name having count(name)>1 The problem is name is not one column but made up of firstname, lastname...how do I do th

Re: [GENERAL] can't cast char to in

2008-04-22 Thread blackwater dev
Yeah, it was my being stupid, I got it going now. Thanks! On Tue, Apr 22, 2008 at 11:42 AM, Erik Jones <[EMAIL PROTECTED]> wrote: > > On Apr 22, 2008, at 10:34 AM, blackwater dev wrote: > > I have a table with a mileage column that is a character varying (please > > don

[GENERAL] can't cast char to in

2008-04-22 Thread blackwater dev
I have a table with a mileage column that is a character varying (please don't ask why :). I need to do a query where mileage > 500 select * from cars where mileage>500 So I need to cast it but everything I try throws an error such as : ERROR: invalid input syntax for integer: "+" How can I c

[GENERAL] copy with escape

2008-02-25 Thread blackwater dev
I have data that I'm running through pg_escape_sting in php and then adding to stdin for a copy command. The problem is "O'reilly" is being changed to "O''Reilly" in the string and then in the db. I saw with the copy command I can specify the escape but it isn't working for me. Should this comma

[GENERAL] joining on concatonation?

2008-02-22 Thread blackwater dev
I have a query that is driving me nuts. In one table we have data that is split between two columns and I'm trying to pull in all values from another table where that column is represented by one piece of data. Also, all the info in column2 is unique but not in col 1. table1 col1_pfx col2_numbe

[GENERAL] bulk copy

2008-01-15 Thread blackwater dev
Hello all, I'm pulling in a csv file nightly and need to pump in into my db. My plan is to pump it into a temp table and then to an update or insert from the temp table to the real table. I'm having an issue, however, with the copy. Here is a my syntax. COPY cars FROM 'cars04.txt'

Re: [TLM] Re: [GENERAL] batch insert/update

2007-12-31 Thread blackwater dev
h two rows, one with is_new of 1 and some with 0. Just don't know if this would be best. On Dec 26, 2007 3:13 PM, Ivan Sergio Borgonovo <[EMAIL PROTECTED]> wrote: > On Wed, 26 Dec 2007 20:48:27 +0100 > Andreas Kretschmer <[EMAIL PROTECTED]> wrote: > > > blackwat

[GENERAL] batch insert/update

2007-12-26 Thread blackwater dev
I have some php code that will be pulling in a file via ftp. This file will contain 20,000+ records that I then need to pump into the postgres db. These records will represent a subset of the records in a certain table. I basically need an efficient way to pump these rows into the table, replacin

[GENERAL] query on table name to return columns and data types?

2006-12-15 Thread blackwater dev
How can I run a query based on a table name and get the column names and data types returned? Thanks!

[GENERAL] finding gps within polygon

2006-06-29 Thread blackwater dev
Hello,Does anyone have a good tutorial on finding gps points within a polygon?  I need to be able to pass in a list of gps coordinates and let postgres return to me matching cities from my cities table that are within that polygon. Thanks!

[GENERAL] insert multiple rows

2005-10-31 Thread blackwater dev
In MySQL, I can insert multiple rows like this: insert into cars values(5, "toyota"),(5,"ford"), etc. How can I do something similiar in PostgreSQL? Thanks! ---(end of broadcast)--- TIP 4: Have you searched our list archives? http:

[GENERAL] mysql replace in postgreSQL?

2005-10-28 Thread blackwater dev
In MySQL, I can use the replace statement which either updates the data there or inserts it. Is there a comporable syntax to use in postgreSQL? I need to do an insert and don't want to have to worry about if the data is already there or not...so don't want to see if it there, if so do update if n