Re: [SQL] SQL syntax rowcount value as an extra column in the result set

2010-03-26 Thread A. Kretschmer
In response to Jayadevan M : Hi, I don't think so. Oracle - SQL select count(*) over () as ROWCOUNT , first_name from people; ROWCOUNT FIRST_NAME -- - --- 6 Mary

Re: [SQL] Help me with this multi-table query

2010-03-26 Thread A. Kretschmer
In response to Nilesh Govindarajan : Hi, I want to find out the userid, nodecount and comment count of the userid. I'm going wrong somewhere. Check my SQL Code- Check my example: test=*# select * from u; id 1 2 3 (3 rows) test=*# select * from n; uid - 1 1 1

Re: [SQL] SQL syntax rowcount value as an extra column in the result set

2010-03-26 Thread Jayadevan M
Hi, It works, but you should use a recent version: test=*# select count(1) over (), i from foo; count | i ---+ 8 | 1 8 | 2 8 | 3 8 | 6 8 | 7 8 | 9 8 | 13 8 | 14 (8 rows) test=*# select version();

Re: [SQL] SQL syntax rowcount value as an extra column in the result set

2010-03-26 Thread Thomas Kellerer
Jayadevan M, 26.03.2010 07:56: Thank you for setting that right. Apologies for not checking version. The orginal poster stated that he is using 8.4, so that solution will work for him. Thomas -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your

Re: [SQL] Plpgsql: Iterating through a string of parameters

2010-03-26 Thread Jasen Betts
On 2010-03-25, Leif Biberg Kristensen l...@solumslekt.org wrote: I'm struggling with how to make plpgsql iterate through a list of numbers input as a text string, eg. 1438 2656 973 4208. I figure that I can use the regexp_split_to_array() function to make an array of the string, but can I

Re: [SQL] Week to date function

2010-03-26 Thread Ireneusz Pluta
Sergey Konoplev pisze: On 25 March 2010 12:25, Ireneusz Pluta ipl...@wp.pl wrote: Hello, is there any standard function, or a concise solution based on set of them, returning a set of dates included in a week of given year and week number? I ended up with creating my own function as in the

Re: [SQL] Week to date function

2010-03-26 Thread Sergey Konoplev
CREATE OR REPLACE FUNCTION your_week2date(double precision, double precision) RETURNS SETOF date AS $_$ SELECT  day FROM (   SELECT  (               date_trunc('week', ($1::text||'-01-01')::date)               + ($2::text||' week')::interval               + ( d::text||'  day')::interval

Re: [SQL] Week to date function

2010-03-26 Thread Ireneusz Pluta
Sergey Konoplev pisze: CREATE OR REPLACE FUNCTION your_week2date(double precision, double precision) RETURNS SETOF date AS $_$ SELECT day FROM ( SELECT ( date_trunc('week', ($1::text||'-01-01')::date) + ($2::text||' week')::interval + ( d::text||'