[SQL] SELECT multiple MAX(id)s ?

2008-10-10 Thread Aarni Ruuhimäki
Hello list, table diary_entry entry_id SERIAL PK d_entry_date_time timestamp without time zone d_entry_company_id integer d_entry_location_id integer d_entry_shift_id integer d_user_id integer d_entry_header text ... Get the last entries from companies and their locations? The last, i.e. the

Re: [SQL] dateformat issue

2008-04-10 Thread Aarni Ruuhimäki
and platform are you using ? Pg version ? I use pg 8.x's on CentOS and Fedora with CF 5 Pro Linux and CFMX7 Standard. I also heard that CFMX7+ would install and run ok on Ubuntu. Best regards, -- Aarni Ruuhimäki --- Burglars usually come in through your windows. --- -- Sent via pgsql-sql mailing

Re: [SQL] dateformat issue

2008-04-10 Thread Aarni Ruuhimäki
| 2008-04-10 This is on CFMX7. Best regards, -- Aarni Ruuhimäki --- Burglars usually come in through your windows. --- -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Counting days ...

2008-03-14 Thread Aarni Ruuhimäki
in period 6. start_day = period_start, end_day = period_end 7. start_day in period, end_day = period_end 8. start_day in period, end_day after period_end 9. start_day = period_start, end_day = period_end 10 start_day before period_start, end_day after period_end Hmm ... Best regards, -- Aarni

Re: [SQL] Counting days ...

2008-03-14 Thread Aarni Ruuhimäki
' AND res_end_day = '$date1' [AND region_id = $region_id] [AND company_id = $company_id] [AND product_id = $product_id] Cheerio, -- Aarni Ruuhimäki --- Burglars usually come in through your windows. --- -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your

[SQL] Counting days ...

2008-03-13 Thread Aarni Ruuhimäki
: SELECT count(country_id) FROM countries; count --- 243 (1 row) Country_id is also stored in the product_res table. I would like to, or need to, get the total split into different nationalities, like: FI 12345 RU 9876 DE 4321 ... Anyone ? With very best regards, -- Aarni Ruuhimäki

Re: [SQL] Counting days ...

2008-03-13 Thread Aarni Ruuhimäki
This was superfast, thank you ! On Thursday 13 March 2008 20:58, Steve Crawford wrote: Aarni Ruuhimäki wrote: res_id 2, start_day 2008-02-10, end_day 2008-02-15, number of persons 4 If you use the same inclusive counting of days for res_id 2, you have 4 persons (don't know where 5 came

Re: [SQL] SQL standards in Mysql

2008-02-24 Thread Aarni Ruuhimäki
On Saturday 23 February 2008 07:50, Tom Lane wrote: Hmm ... while ... so I'm disinclined to throw the first stone ... Meanwhile, Throw cones, not stones. http://cfx.kymi.com/lotsacones.jpg These things/projectiles hurt not so much. And it's fun ! BR, -- Aarni Ruuhimäki

[SQL] Originally created and last_mod by whom and when ?

2007-11-14 Thread Aarni Ruuhimäki
Hello, In a web app (Pg 8.2.4 + php) I have product and other tables with fields like product_created timestamp without time zone product_created_user_id integer product_last_mod timestamp without time zone product_last_mod_user_id integer The person who last modified an item can obviously be

Re: [SQL] Originally created and last_mod by whom and when ?

2007-11-14 Thread Aarni Ruuhimäki
On Wednesday 14 November 2007 13:28, Richard Huxton wrote: Aarni Ruuhimäki wrote: Hello, In a web app (Pg 8.2.4 + php) I have product and other tables with fields like product_created timestamp without time zone product_created_user_id integer product_last_mod timestamp without

Re: [SQL] how to download linux 7.3 image

2007-07-23 Thread Aarni Ruuhimäki
Distribution derived from sources freely provided to the public by a prominent North American Enterprise Linux vendor.' Their latest release comes with PostgreSQL 8.1 BR, Aarni -- Aarni Ruuhimäki ---(end of broadcast)--- TIP 4: Have you searched

Re: [SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-08 Thread Aarni Ruuhimäki
, colname_3) SELECT (colname_1, colname_2, colname_3) FROM mytable WHERE pk = 123; BR, -- Aarni Ruuhimäki ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] interval as hours or minutes ?

2007-02-08 Thread Aarni Ruuhimäki
' to 3728 ? Thanks, -- Aarni Ruuhimäki ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] interval as hours or minutes ?

2007-02-08 Thread Aarni Ruuhimäki
Ahh, Forgot about trunc() in the midst of all this ... Thank you guys again ! Aarni On Thursday 08 February 2007 12:06, Bart Degryse wrote: Use trunc instead of round. Also take a look at ceil and floor functions Aarni Ruuhimäki [EMAIL PROTECTED] 2007-02-08 11:01 On Thursday 08

[SQL] interval as hours or minutes ?

2007-02-07 Thread Aarni Ruuhimäki
4.4 ??? Thanks, -- Aarni Ruuhimäki ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] How to autoincrement a primary key...

2006-09-23 Thread Aarni Ruuhimäki
SEQUENCE foo START n INCREMENT BY n MAXVALUE n MINVALUE n CACHE 1; BR, Aarni -- Aarni Ruuhimäki **Kmail** **Fedora Core Linux** ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] double precision vs. numeric

2006-08-28 Thread Aarni Ruuhimäki
On Monday 28 August 2006 16:08, you wrote: So this merely means that in future one can not insert empty values into field of type double precision ? Right. 8.0 issues a warning and 8.1 gives an error: Ok, thanks. But NULLs will go in the future too ? BR, Aarni -- Aarni Ruuhimäki

[SQL] double precision vs. numeric

2006-08-24 Thread Aarni Ruuhimäki
fields type double precision and have so far upgraded ok since 7.0.x (I now use numeric with appropriate precision and scale.) Is there something to worry about when upgrading next time ? Start changing these to numeric perhaps ? Running 8.0.2 at the moment. Best regards to all, Aarni -- Aarni

Re: [SQL] double precision vs. numeric

2006-08-24 Thread Aarni Ruuhimäki
an index scan if your joining column's datatypes do not match Well, I have used it for 'money type' like sums and prices but I have never used the actual money data type. So, false alarm. Thank you guys ! Aarni -- Aarni Ruuhimäki **Kmail** **Fedora Core Linux

Re: [SQL] UTF-8 Problem ?

2006-06-15 Thread Aarni Ruuhimäki
| user1 | SQL_ASCII postgres | pg| UTF8 template0 | pg| UTF8 template1 | pg| UTF8 How to solve my problem ? Best Regards. Milen ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster -- Aarni Ruuhimäki

Re: [SQL] Copying a row within table

2006-03-15 Thread Aarni Ruuhimäki
On Wednesday 15 March 2006 03:11, John DeSoi wrote: On Mar 14, 2006, at 2:19 AM, Aarni Ruuhimäki wrote: testing=# INSERT INTO foo (foo_1, foo_2, foo_3 ...) (SELECT foo_1, foo_2, foo_3 ... FROM message_table WHERE foo_id = 10); INSERT 717286 1 testing=# Is there a fast way to copy

[SQL] Copying a row within table

2006-03-13 Thread Aarni Ruuhimäki
=# Is there a fast way to copy all but not the PK column to a new row within the same table so that the new foo_id gets its value from the sequence ? TIA and BR, Aarni -- Aarni Ruuhimäki -- This is a bugfree broadcast to you from **Kmail** on **Fedora Core** linux system

[SQL] Querying date_time for date only ?

2005-12-20 Thread Aarni Ruuhimäki
Hello List, I have a time stamp without time zone field, -MM-DD hh:mm:ss, in my table. I want to also find something just for a particular day regardless of the time. (Pg)SQL way to do this ? TIA, Aarni -- -- This is a bugfree broadcast to you from **Kmail** on **Fedora

Re: [SQL] Querying date_time for date only ?

2005-12-20 Thread Aarni Ruuhimäki
On Tuesday 20 December 2005 15:19, Michael Burke wrote: On December 20, 2005 08:59 am, Aarni Ruuhimäki wrote: Hello List, I have a time stamp without time zone field, -MM-DD hh:mm:ss, in my table. I want to also find something just for a particular day regardless of the time

Re: [SQL] Multi-row update w. plpgsql function

2005-12-14 Thread Aarni Ruuhimäki
through the other two values submitted. Can someone help this novice from getting ulcers? Thanks for your help! Daniel ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster -- Aarni Ruuhimäki -- This is a bugfree broadcast

Re: [SQL] encoding

2005-05-08 Thread Aarni Ruuhimäki
, Aarni On Saturday 07 May 2005 23:54, you wrote: Aarni Ruuhimäki wrote: You might also want (re?)configure your Pg-system with --enable-locale and set your preferred locale and db default encoding in initdb to suit your needs, in order to have alphabetical sortings etc. work ok. If you're

Re: [SQL] encoding

2005-05-08 Thread Aarni Ruuhimäki
.) The more relevant check is configure --help | grep locale regards, tom lane -- Aarni Ruuhimäki Megative Tmi Pääsintie 26 45100 Kouvola Finland +358-5-3755035 +358-50-4910037 www.kymi.com | cfm.kymi.com -- This is a bugfree broadcast to you from **Kmail** on **Fedora Core 2

Re: [SQL] encoding

2005-05-07 Thread Aarni Ruuhimäki
Hi, In my experience , I think your best bet and an all-around good general encoding to use is latin1, which copes with l'accent egys graves, umlauts, harasoos and others. Not so sure about the M$-import stuff though. Or asp or .net. Read the Gates Private Licence ... You might also want

Re: [SQL] Read count ?

2005-02-28 Thread Aarni Ruuhimäki
# - #count# /cfoutput On Saturday 26 February 2005 15:24, you wrote: On Thu, 2005-02-24 at 17:17 +0200, Aarni Ruuhimäki wrote: Hi, Could someone please give a hint on how to query the following neatly ? Get news from a news table that belong to a particular account, get segment name

[SQL] Read count ?

2005-02-24 Thread Aarni Ruuhimäki
Hi, Could someone please give a hint on how to query the following neatly ? Get news from a news table that belong to a particular account, get segment name from segments table for each news item and read count from read history table that gets a news_id and timestamp insert every time the

Re: [SQL] trrouble inserting stuff like é

2005-02-19 Thread Aarni Ruuhimäki
, but the odbc would not work. I hope it works ok with the LATIN1. -Original Message- From: Aarni Ruuhimäki [mailto:[EMAIL PROTECTED] Sent: Friday, February 18, 2005 10:25 AM To: Joel Fradkin Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] trrouble inserting stuff like é Hi, I use

Re: [SQL] trrouble inserting stuff like é

2005-02-18 Thread Aarni Ruuhimäki
Hi, I use LATIN1 encoding and it works fine with accented characters. So try creating your db with -E LATIN1 switch. Or even initdb -E LATIN1 if you wan't your dbs default to that. Best regards, Aarni On Friday 18 February 2005 16:59, you wrote: I wrote a program to read my database (from