[SQL] equivalent of oracle rank() in postgres

2005-03-20 Thread Chandan_Kumaraiah
  Hi,   Jus wanted the equivalent for rank() as in tis example..   SELECT * FROM (   SELECT employee_id, last_name, salary,   RANK() OVER (ORDER BY salary DESC) EMPRANK   FROM employees) WHERE emprank = 3;   Rgds, Chandan

Re: [SQL] tablename as function parameter

2005-03-20 Thread Jonathan Daugherty
# I'm trying to create a function (language 'sql') with table name as # single input parameter, but I always get syntax errors at # "$1". Probably I am use wrong types. # # simple example: # # create function testfct (text) language sql as 'select count(*) from # $1' This doesn't work because th

[SQL] timestamp precision - can I control precision at select time or set for all time?

2005-03-20 Thread [EMAIL PROTECTED]
I have a database with several tables that use timestamp without time zone type. I upgraded from an older pgsql and have code that does not expect the precision in the select output. Is there a way I can get the effect of zero precision without modifying all the tables? The docs say it usees "defa

[SQL] query

2005-03-20 Thread Chandan_Kumaraiah
Hi,   In oracle we write sysdate-1 For example,we write a query (select * from table1 where created_date>=sysdate-1).Whats its equivalent in postgre?   Chandan  

Re: [SQL] Group by 15 Minute Steps

2005-03-20 Thread Jonathan Daugherty
# Usally, the steps between each entries is 300 seconds. How can I # group by by 15, 30, 45 minutes so that i can get averages over the # specified timeframe? For 15-minute data, I'd compute the "quadrant" of each record and group by the quadrant number. Anything that occurs from :00 to :14 is i

[SQL]

2005-03-20 Thread Octavio Alvarez
Sorry, I tried to make my subject as good as possible. I have a table where I store the dates in which I take out of my inventory (like "installation dates") table --- row_id SERIAL date DATE fk_item INTEGER and that's pretty much it. I want to have a query returning how long

[SQL] tablename as function parameter

2005-03-20 Thread Hermann Draeger
I'm trying to create a function (language 'sql') with table name as single input parameter, but I always get syntax errors at "$1". Probably I am use wrong types. simple example: create function testfct (text) language sql as 'select count(*) from $1' fails. I tested type alternatives to 'text

[SQL] date subtraction

2005-03-20 Thread Ashok Agrawal
I need to do date calculation similar to oracle in postgres. like sysdate - creation_date of the record which returns no of days in oracle which you can convert to hours or second by multiplying by 60 or 3600. How do i achieve this in postgres. Thanks Ashok ---(end of

[SQL] Group by 15 Minute Steps

2005-03-20 Thread Martin Knipper
Hi, does anyone hava an idea how to group data e.g by 15 minute steps? I have the following data in my "data_diff" table [...] snmp=# \d data_diff Table "public.data_diff" Column | Type | Modifiers -+-+---

Re: [SQL] Mail Authentification

2005-03-20 Thread tgl
Norman Virus Control a supprimé le message original qui contenait le virus [EMAIL PROTECTED] ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings