Re: [SQL] SELECT multiple MAX(id)s ?

2008-10-23 Thread Aarni
On Tuesday 14 October 2008 18:27:01 Fernando Hevia wrote: > > -Mensaje original- > > De: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] En nombre de Aarni Ruuhimäki > > Enviado el: Viernes, 10 de Octubre de 2008 07:56 > > Para: pgsql-sql@postgresql.org >

[SQL] SELECT multiple MAX(id)s ?

2008-10-10 Thread Aarni Ruuhimäki
| Dayshift 2 | Company 2 | Location C ... Someone please give me a start kick? TIA and have a nice weekend too! -- Aarni 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.or

Re: [SQL] dateformat issue

2008-04-10 Thread Aarni Ruuhimäki
On Thursday 10 April 2008 09:41, Gavin 'Beau' Baumanis wrote: > Hi Aarni, > > just so you know I am using the CF built-in function, > createodbcdate > > here is the info from livedocs. > > CreateODBCDate > Description > > Returns a date in ODBC date for

Re: [SQL] dateformat issue

2008-04-09 Thread Aarni Ruuhimäki
ion script ? Which client (browser?) / platform produces the error ? And just out of general interest, which cf-version 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

Re: [SQL] Counting days ...

2008-03-15 Thread Aarni Ruuhimäki
t_res pr LEFT JOIN countries c ON pr.country_id = c.country_id WHERE group_id = 1 AND group_size > 0 AND res_start_day <= '#date1#' AND res_end_day >= '#date1#' AND res_end_day > res_start_day AND region_id = #form.region# AND company_id = #form.companyt# AND

Re: [SQL] Counting days ...

2008-03-14 Thread Aarni Ruuhimäki
_day = '$date1' AND res_end_day >= '$date1' [AND region_id = $region_id] [AND company_id = $company_id] [AND product_id = $product_id] OR group_id = 1 AND res_start_day >= '$date1' AND res_start_day < '$date2' AND res_end_day >= '$date1&#x

Re: [SQL] Counting days ...

2008-03-14 Thread Aarni Ruuhimäki
Thanks Frank, Top and between posting ... On Friday 14 March 2008 15:58, Frank Bax wrote: > Frank Bax wrote: > > Aarni Ruuhimäki wrote: > >> Anyway, I have to rethink and elaborate the query. I know that it will > >> usually be on a monthly or yearly basis, but a reser

Re: [SQL] Counting days ...

2008-03-14 Thread Aarni Ruuhimäki
riod_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 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-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 > p

[SQL] Counting days ...

2008-03-13 Thread Aarni Ruuhimäki
Ok, but a reservation can be of any nationality / country: 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

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,

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

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

2007-11-14 Thread Aarni Ruuhimäki
/ date and time Join, sub select ? I tried some but only managed to get only one name, errors, nothing at all or two rows with inner join + union ... Lotsa thanks for any help, Aarni -- ---(end of broadcast)--- TIP 7: You can help support the

Re: [SQL] how to download linux 7.3 image

2007-07-23 Thread Aarni Ruuhimäki
x27;an Enterprise-class Linux 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)---

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]>

Re: [SQL] interval as hours or minutes ?

2007-02-08 Thread Aarni Ruuhimäki
start_date_time) FROM work_times WHERE user_id = 10))/60) as mins; mins -- 3729 (1 row) So instead of rounding up to 3729 the result would have to be 'stripped' 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] Seeking quick way to clone a row, but give it a new pk.

2007-02-08 Thread Aarni Ruuhimäki
u are copying all columns, including the pk. Try: INSERT INTO mytable (colname_1, colname_2, 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

[SQL] interval as hours or minutes ?

2007-02-07 Thread Aarni Ruuhimäki
entOs 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-22 Thread Aarni Ruuhimäki
>match Verbosily you can have even more control over the sequence. With SERIAL the default is something like CREATE SEQUENCE foo INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1; By hand you can define e.g. CREATE SEQUENCE foo START n INCREMENT BY n MAXVALUE

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 ?

Re: [SQL] double precision vs. numeric

2006-08-28 Thread Aarni Ruuhimäki
On Friday 25 August 2006 08:12, Aarni Ruuhimäki wrote: > On Thursday 24 August 2006 20:29, Tom Lane wrote: > > Aarni =?iso-8859-1?q?Ruuhim=E4ki?= <[EMAIL PROTECTED]> writes: > > > I vaguely remember having seen a message > > > ' ... type double precision ..

Re: [SQL] double precision vs. numeric

2006-08-24 Thread Aarni Ruuhimäki
On Thursday 24 August 2006 20:29, Tom Lane wrote: > Aarni =?iso-8859-1?q?Ruuhim=E4ki?= <[EMAIL PROTECTED]> writes: > > I vaguely remember having seen a message > > ' ... type double precision ... will be depreciated / unsupported in > > future releases ... '

[SQL] double precision vs. numeric

2006-08-24 Thread Aarni Ruuhimäki
ne or more 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

Re: [SQL] UTF-8 Problem ?

2006-06-15 Thread Aarni Ruuhimäki
Hello, Db-encoding LATIN1 works fine for me with german, scandic, other umlauted or accented and even cyrillic characters. BR, Aarni On Thursday 15 June 2006 14:01, Milen Kulev wrote: > Hi Listers, > I want to insert some german specific characters (umlaut characters) into a > table,

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 > >

[SQL] Copying a row within table

2006-03-13 Thread Aarni Ruuhimäki
1 testing=# 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** li

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 particula

[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] Multi-row update w. plpgsql function

2005-12-14 Thread Aarni Ruuhimäki
t; name="approved" value="4" and 1, 3 and 4 are checked your form data will be approved=1,3,4 Then you can just say UPDATE message_table SET status = 'A' WHERE mid IN($approved); Not a function though. BR, Aarni testing=# SELECT * FROM message_table; mid | messa

Re: [SQL] encoding

2005-05-08 Thread Aarni Ruuhimäki
Ain't trying to prove no one no thing. So sorry. Thamks. On Sunday 08 May 2005 19:43, you wrote: > Aarni =?iso-8859-1?q?Ruuhim=E4ki?= <[EMAIL PROTECTED]> writes: > >> If you're still using a PostgreSQL version that has the --enable-locale > >> option then yo

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 sort

Re: [SQL] encoding

2005-05-07 Thread Aarni Ruuhimäki
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. BR, Aarni On Friday 06 May 2005 16:50, you wrote: > I am not clear on what makes this work?

Re: [SQL] Read count ?

2005-02-28 Thread Aarni Ruuhimäki
, news_header, segment, segment_id ORDER BY count DESC ... SELECT segment_name FROM segments_table WHERE segment_id = #segment# #news_header# - #get_seg.segment_name# - #count# On Saturday 26 February 2005 15:24, you wrote: > On Thu, 2005-02-24 at 17:17 +0200, Aarni Ruuhimäki wr

[SQL] Read count ?

2005-02-24 Thread Aarni Ruuhimäki
: news_id, account_id, segment_id, news_header, ... segments_table: segment_id, account_id, segment_name read_history_table: history_id, news_id, timestamp TIA, Aarni -- This is a bugfree broadcast to you from **Kmail** on **Fedora Core 2** linux system

Re: [SQL] trrouble inserting stuff like é

2005-02-19 Thread Aarni Ruuhimäki
internet. We are using RH, FC2 and TSL (Trustix Secure Linux) as servers. BR, Aarni On Friday 18 February 2005 22:37, you wrote: > Looking deeper into the matter (which I admit I am a bit ignorant on) I > think you hit the nail on the head. > Coming from MSSQL which is using Latin I ma

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 databa

[SQL] Querying a list field against another list

2004-11-26 Thread Aarni Ruuhimäki
r query I have parameter bar = '1,4' and want to find all rows from foo where da_list contains '1' or '4'. So loop over bar to loop over da_list in foo ? My humble thanks, Aarni -- This is a bugfree broadcast to you from **Kmail** on **Fedora