[SQL] function to find difference between in days between two dates

2007-06-13 Thread Ashish Karalkar
Hello all, Is there any function to find differences in days between two dates? I am using select abs(current_date - '2007-06-15') to get the desired result. but I think there must be a function and I am missing it, if so, can anybody please point me to that. Thanks in advance With regar

Re: [SQL] setof or array as input parameter to postgresql 8.2 functions

2007-06-13 Thread Jyoti Seth
Thanks a lot. Regards, Jyoti -Original Message- From: Pavel Stehule [mailto:[EMAIL PROTECTED] Sent: Thursday, June 14, 2007 11:27 AM To: Jyoti Seth Cc: [EMAIL PROTECTED]; pgsql-sql@postgresql.org Subject: Re: [SQL] setof or array as input parameter to postgresql 8.2 functions 2007/6/14,

Re: [SQL] setof or array as input parameter to postgresql 8.2 functions

2007-06-13 Thread Pavel Stehule
2007/6/14, Jyoti Seth <[EMAIL PROTECTED]>: Thanks for the solution. With this I am able to pass arrays and multidimensional arrays in postgresql functions. One of my problem is still left I want to pass set of values with different datatypes.For eg: I want to pass following values to the functio

Re: [SQL] setof or array as input parameter to postgresql 8.2 functions

2007-06-13 Thread Jyoti Seth
Thanks for the solution. With this I am able to pass arrays and multidimensional arrays in postgresql functions. One of my problem is still left I want to pass set of values with different datatypes.For eg: I want to pass following values to the function: 1 ajay 1000.12 2 rita 2300.24 3 leena 12

Re: [SQL] calculate time diffs across rows with single timestamp

2007-06-13 Thread Bob Singleton
Rodrigo De León wrote: On Jun 13, 11:17 am, [EMAIL PROTECTED] (Bob Singleton) wrote: Any suggestions on how I can build a result set that would return ASSET 001 AAA 1:00 (1 hour) ASSET 001 BBB 0:10 (10 minutes) ASSET 001 CCC 0:08 (8 minutes) ASSET 001 DDD {difference between times

Re: [SQL] calculate time diffs across rows with single timestamp

2007-06-13 Thread Rodrigo De León
On Jun 13, 11:17 am, [EMAIL PROTECTED] (Bob Singleton) wrote: > Any suggestions on how I can build a result set that would return > > ASSET 001 AAA 1:00 (1 hour) > ASSET 001 BBB 0:10 (10 minutes) > ASSET 001 CCC 0:08 (8 minutes) > ASSET 001 DDD {difference between timestamp and now()} > ASSET 002 A

[SQL] calculate time diffs across rows with single timestamp

2007-06-13 Thread Bob Singleton
First post - please pardon if I'm posted to the wrong group. I have a table 'statuslog' type varchar NOT NULL id varchar NOT NULL status varchar datetime timestamp NOT NULL Example data type id status datetime ASSET 001 AAA 2007-06-08 13:42:00.00

Re: [SQL] join problem

2007-06-13 Thread Ales Vojacek
There is not referenced table cai in from clausule. A. R. Van Hook napsal(a): > I have join problem: > "select i.ivid, v.eventdate, v.deposit, v.invdate, cai.db, > sum(i.tax) as tax, > sum(i.tax + i.rowtot) as totalP, > (sum(i.tax + i.rowtot) - v.dep

Re: [SQL] join problem

2007-06-13 Thread Michael Glaesemann
On Jun 13, 2007, at 8:19 , A. R. Van Hook wrote: I have join problem: "select i.ivid, v.eventdate, v.deposit, v.invdate, cai.db, sum(i.tax) as tax, sum(i.tax + i.rowtot) as totalP, (sum(i.tax + i.rowtot) - v.deposit) as balance from

Re: [SQL] join problem

2007-06-13 Thread Ales Vojacek
You can do it like this: select i.ivid, v.eventdate, v.deposit, v.invdate, cai.db, sum(i.tax) as tax, sum(i.tax + i.rowtot) as totalP, (sum(i.tax + i.rowtot) - v.deposit) as balance from invoice v join cai on v.cusid = cai

Re: [SQL] join problem

2007-06-13 Thread Guillaume Lelarge
A. R. Van Hook a écrit : > I have join problem: > "select i.ivid, v.eventdate, v.deposit, v.invdate, cai.db, > sum(i.tax) as tax, > sum(i.tax + i.rowtot) as totalP, > (sum(i.tax + i.rowtot) - v.deposit) as balance > from invoice v >

[SQL] join problem

2007-06-13 Thread A. R. Van Hook
I have join problem: "select i.ivid, v.eventdate, v.deposit, v.invdate, cai.db, sum(i.tax) as tax, sum(i.tax + i.rowtot) as totalP, (sum(i.tax + i.rowtot) - v.deposit) as balance from invoice v left outer join

Re: [SQL] setof or array as input parameter to postgresql 8.2 functions

2007-06-13 Thread Pavel Stehule
Hello maybe: create function foo(varchar[][]) returns void as $$ begin end$$ language plpgsql; postgres=# select foo(array[array[1,2], array[2,2]]::varchar[][]); foo - (1 row) Regards Pavel Stehule 2007/6/13, Jyoti Seth <[EMAIL PROTECTED]>: Hi, I have to pass a set of values and

[SQL] setof or array as input parameter to postgresql 8.2 functions

2007-06-13 Thread Jyoti Seth
Hi, I have to pass a set of values and arrays in postgresql 8.2 functions. But I am not getting any help on that. Please let me know if any one has idea. Thanks, Jyoti

[SQL] sql server to postgreSQL

2007-06-13 Thread Ashish Karalkar
Hello All, I have a long list of sql server queries that needs to me remoulded in to postgres format can anyone please suggest me any tool that will convert sqlserver query into postgresql query except SwisSQL - SQLOne Console 3.0 Thanks in advance With regards Ashish Karalkar